19#include "util/stringutil.h"
55class LogConfig final {
57 LogConfig(
const LogConfig &) =
delete;
58 LogConfig(LogConfig &&) =
delete;
59 LogConfig &operator=(
const LogConfig &) =
delete;
60 LogConfig &operator=(LogConfig &&) =
delete;
90 std::unique_ptr<ILogger> logger);
102 const std::vector<std::string> &arg_list);
116 const std::string &logger_name)
const;
159 [[nodiscard]]
const std::string &
SubDir()
170 application_name_ = app_name;
180 return application_name_;
184 std::atomic<bool> enabled_ =
true;
186 std::string base_name_;
187 std::string sub_dir_;
188 std::string root_dir_;
189 std::string application_name_;
191 mutable std::mutex locker_;
Interface against a generic logger.
Definition ilogger.h:35
Singleton class that is used for configure the default logger in an application.
Definition logconfig.h:55
void Enabled(bool enabled)
Turns off or on the loggers.
void BaseName(const std::string &base_name)
Sets the base name (stem) of the log file.
const std::string & BaseName() const
Returns the base name.
bool CreateDefaultLogger()
Create a logger named 'Default'.
ILogger * GetLogger(const std::string &logger_name) const
Returns a logger by name.
static LogConfig & Instance()
Returns this class (singleton).
void AddLogMessage(const LogMessage &message) const
Adds a log message.
void AddLogger(const std::string &logger_name, std::unique_ptr< ILogger > logger)
Adds a logger with a unique name.
void SubDir(const std::string &sub_dir)
Sets the sub directory.
void RootDir(const std::string &root_dir)
Sets the root directory.
void DeleteLogChain()
Clear the list of loggers.
void DeleteLogger(const std::string &logger_name)
Deletes a logger.
bool Enabled() const
Returns true if the loggers are enabled.
std::string GetLogFile(const std::string &logger_name="Default") const
Returns a log file.
void AddLogger(const std::string &logger_name, LogType type, const std::vector< std::string > &arg_list)
Adds a predefined logger with a unique name.
LogType Type() const
Returns the type of default logger.
void Type(LogType log_type)
Sets the type of default logger.
const std::string & ApplicationName()
Returns the default application name.
Definition logconfig.h:179
const std::string & SubDir() const
Returns the sub directory.
const std::string & RootDir() const
Return the root directory.
void ApplicationName(const std::string &app_name)
Sets the default application name.
Definition logconfig.h:169
Definition stringutil.h:33
Defines an interface against a generic logger.
The log namespace is used for log related classes and functions.
Definition idirectory.h:18
std::string ProgramDataPath()
LogType
Definition ilogger.h:21
@ LogNothing
No logger.
Definition ilogger.h:22
Definition logmessage.h:26