Skip to content

Commit

Permalink
fix: change visibility for the symbols of logger
Browse files Browse the repository at this point in the history
Signed-off-by: Daeyeon Jeong <[email protected]>
  • Loading branch information
daeyeon authored and hs0225 committed Mar 27, 2024
1 parent a5b1444 commit 2ac0924
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 10 additions & 3 deletions src/api/utils/logger/logger-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#include <sstream>
#include <string>

#ifndef LWNODE_EXPORT
#define LWNODE_EXPORT __attribute__((visibility("default")))
#endif

class LogFormatter {
public:
std::string header();
Expand Down Expand Up @@ -154,7 +158,7 @@ class StdOut : public Logger::Output {

using OutputInstantiator = std::function<std::shared_ptr<Logger::Output>()>;

class LogOption {
class LWNODE_EXPORT LogOption {
public:
static void setDefaultOutputInstantiator(OutputInstantiator fn) {
s_outputInstantiator_ = fn;
Expand All @@ -166,8 +170,11 @@ class LogOption {

static std::shared_ptr<Logger::Output> getDefalutOutput() {
if (s_outputInstantiator_ == nullptr) {
// Set default output
s_outputInstantiator_ = []() { return std::make_shared<StdOut>(); };
static std::shared_ptr<Logger::Output> default_output;
if (default_output == nullptr) {
default_output = std::make_shared<StdOut>();
}
return default_output;
}
return s_outputInstantiator_();
}
Expand Down
6 changes: 3 additions & 3 deletions src/api/utils/logger/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,20 @@ struct DLogConfig : Logger::Output::Config {
std::string tag;
};

class LWNodeLogger : public Logger {
class LWNODE_EXPORT LWNodeLogger : public Logger {
public:
LWNodeLogger(std::shared_ptr<DLogConfig> config) { outConfig_ = config; }
};

class DlogOut : public Logger::Output {
class LWNODE_EXPORT DlogOut : public Logger::Output {
public:
void flush(std::stringstream& ss,
std::shared_ptr<Output::Config> config = nullptr) override;
void appendEndOfLine(std::stringstream& ss) override;
bool hasAutoAppendEndOfLine() override { return true; }
};

class LogKind {
class LWNODE_EXPORT LogKind {
public:
static std::shared_ptr<DLogConfig> user() { return getInstance()->user_; }
static std::shared_ptr<DLogConfig> lwnode() { return getInstance()->lwnode_; }
Expand Down

0 comments on commit 2ac0924

Please sign in to comment.