EpcTools
An event based multi-threaded C++ development framework.
|
Defines a logger. More...
#include <elogger.h>
Public Types | |
enum | LogLevel { eDebug = spdlog::level::trace, eInfo = spdlog::level::debug, eStartup = spdlog::level::info, eMinor = spdlog::level::warn, eMajor = spdlog::level::err, eCritical = spdlog::level::critical, eOff = spdlog::level::off } |
Defines the various log levels. More... | |
Public Member Functions | |
ELogger (Int logid, cpStr category, Int sinkid) | |
Class constructor. More... | |
~ELogger () | |
Class destructor. More... | |
template<typename... Args> | |
Void | debug (cpStr format, const Args &... args) |
Writes a debug message to this logger. More... | |
template<typename... Args> | |
Void | info (cpStr format, const Args &... args) |
Writes a info message to this logger. More... | |
template<typename... Args> | |
Void | startup (cpStr format, const Args &... args) |
Writes a startup message to this logger. More... | |
template<typename... Args> | |
Void | minor (cpStr format, const Args &... args) |
Writes a minor message to this logger. More... | |
template<typename... Args> | |
Void | major (cpStr format, const Args &... args) |
Writes a major message to this logger. More... | |
template<typename... Args> | |
Void | critical (cpStr format, const Args &... args) |
Writes a critical message to this logger. More... | |
Void | flush () |
Flushes any unwritten log messages to the underlying sinks. More... | |
Void | setLogLevel (LogLevel lvl) |
Assign a log level for this logger. Any log messages lower than the specified log level will not be written. More... | |
LogLevel | getLogLevel () |
Retrieve the currently assigned log level. More... | |
const std::string & | get_name () |
Retrieve the name (category) of the logger. More... | |
spdlog::level::level_enum | get_level () |
Retrieve the current log level from the underlying spdlog object. More... | |
Void | set_level (spdlog::level::level_enum lvl) |
Sets the current log level of the underlying spdlog object. More... | |
const std::map< std::string, std::shared_ptr< ELogger > > | get_loggers () |
Retrieve the defined loggers. More... | |
Static Public Member Functions | |
static EString & | applicationName () |
Retrieves the application name. More... | |
static EString & | applicationName (cpStr app) |
Assigns the application name. More... | |
static ELogger & | createLog (Int logid, cpStr category, Int sinkid) |
Manually creates a logger. More... | |
static ELoggerSinkSet & | createSinkSet (Int sinkid) |
Manually creates a sink set. More... | |
static ELogger & | log (Int logid) |
Retrieves the requested ELogger object. More... | |
static ELoggerSinkSet & | sinkSet (Int sinkid) |
Retrieves the requested sink set object. More... | |
Static Protected Member Functions | |
static Void | init (EGetOpt &opt) |
Initilizes the logs from the configuration file. More... | |
static Void | uninit () |
Shuts down the logging system. More... | |
Friends | |
class | ELoggerInit |
Defines a logger.
enum ELogger::LogLevel |
ELogger::ELogger | ( | Int | logid, |
cpStr | category, | ||
Int | sinkid | ||
) |
Class constructor.
logid | the log ID for this logger. |
category | the category description for this log. |
sinkid | identifies the set of output sinks for this logger. |
|
inline |
Class destructor.
|
inlinestatic |
Retrieves the application name.
|
inlinestatic |
Assigns the application name.
|
static |
Manually creates a logger.
logid | the log ID for this logger. |
category | the category description for this log. |
sinkid | identifies the set of output sinks for this logger. |
ELoggerError_LogExists | |
ELoggerError_SinkSetNotFound |
|
static |
Manually creates a sink set.
sinkid | the sink ID to assign to this sink set. |
ELoggerError_SinkSetExists |
|
inline |
Writes a critical message to this logger.
format | the format of the log message. |
args | any arguments that will be substituted into the log format. |
|
inline |
Writes a debug message to this logger.
format | the format of the log message. |
args | any arguments that will be substituted into the log format. |
|
inline |
Flushes any unwritten log messages to the underlying sinks.
|
inline |
Retrieve the current log level from the underlying spdlog object.
|
inline |
Retrieve the defined loggers.
|
inline |
Retrieve the name (category) of the logger.
|
inline |
Retrieve the currently assigned log level.
|
inline |
Writes a info message to this logger.
format | the format of the log message. |
args | any arguments that will be substituted into the log format. |
|
staticprotected |
Initilizes the logs from the configuration file.
opt | the options that contain the settings loaded from the configuration file. |
ELoggerError_SinkSetLogIdNotSpecified | |
ELoggerError_SinkSetSinkIdNotSpecified | |
ELoggerError_SinkSetCategoryNotSpecified |
|
inlinestatic |
Retrieves the requested ELogger object.
logid | the log ID for the logger. |
ELoggerError_LogNotFound |
|
inline |
Writes a major message to this logger.
format | the format of the log message. |
args | any arguments that will be substituted into the log format. |
|
inline |
Writes a minor message to this logger.
format | the format of the log message. |
args | any arguments that will be substituted into the log format. |
|
inline |
Sets the current log level of the underlying spdlog object.
lvl | the spdlog log level. |
|
inline |
Assign a log level for this logger. Any log messages lower than the specified log level will not be written.
lvl | the log level to assign. |
|
inlinestatic |
Retrieves the requested sink set object.
sinkid | the sink set ID. |
ELoggerError_SinkSetNotFound |
|
inline |
Writes a startup message to this logger.
format | the format of the log message. |
args | any arguments that will be substituted into the log format. |
|
staticprotected |
Shuts down the logging system.
|
friend |