Skip to content

Commit

Permalink
Update singleton implementation of LogProperties in Log.h
Browse files Browse the repository at this point in the history
  • Loading branch information
FloSewn committed Jun 28, 2024
1 parent 05a7b75 commit 40e7871
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/utils/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,12 @@ class LogProperties
{
public:
/*------------------------------------------------------------------
| Default constructor
|
------------------------------------------------------------------*/
LogProperties()
static LogProperties& get_instance()
{
error_os_ = create_stream( TO_COUT );
warn_os_ = create_stream( TO_COUT );
info_os_ = create_stream( TO_COUT );
debug_os_ = create_stream( TO_COUT );
static LogProperties instance;
return instance;
}

/*------------------------------------------------------------------
Expand Down Expand Up @@ -189,6 +187,21 @@ class LogProperties

private:

/*------------------------------------------------------------------
| Default constructor
------------------------------------------------------------------*/
LogProperties()
{
error_os_ = create_stream( TO_COUT );
warn_os_ = create_stream( TO_COUT );
info_os_ = create_stream( TO_COUT );
debug_os_ = create_stream( TO_COUT );
}

LogProperties(const LogProperties&) = delete;
LogProperties& operator=(const LogProperties&) = delete;


LogLevel level_ = INFO;
bool show_header_ = true;
bool use_newline_ = true;
Expand Down Expand Up @@ -216,7 +229,8 @@ class LogProperties

};

static inline LogProperties LOG_PROPERTIES;
static inline
LogProperties& LOG_PROPERTIES = LogProperties::get_instance();

/*********************************************************************
* The interface for the actual SimpleLogger
Expand Down

0 comments on commit 40e7871

Please sign in to comment.