RSC
0.17.1
|
Interface for logging adapters that can be used with RSC. More...
#include <Logger.h>
Public Types | |
enum | Level { LEVEL_ALL = 0x11111111, LEVEL_TRACE = 60, LEVEL_DEBUG = 50, LEVEL_INFO = 40, LEVEL_WARN = 30, LEVEL_ERROR = 20, LEVEL_FATAL = 10, LEVEL_OFF = 0 } |
Possible logging levels. More... | |
Public Member Functions | |
virtual | ~Logger () |
virtual void | log (const Level &level, const std::string &msg)=0 |
Logs a message with the given level if it is enabled. More... | |
logger configuration | |
virtual Level | getLevel () const =0 |
Returns the currently defined level of the logger. More... | |
virtual void | setLevel (const Level &level)=0 |
Defines the level of the logger. More... | |
virtual std::string | getName () const =0 |
Returns the hierarchical name of the logger. More... | |
virtual void | setName (const std::string &name)=0 |
Sets the name of the logger. More... | |
level-based logging functions | |
Default implementations of this method map to log calls. | |
virtual void | trace (const std::string &msg) |
Logs a message with trace logging level if this level is enabled. More... | |
virtual void | debug (const std::string &msg) |
Logs a message with debug logging level if this level is enabled. More... | |
virtual void | info (const std::string &msg) |
Logs a message with info logging level if this level is enabled. More... | |
virtual void | warn (const std::string &msg) |
Logs a message with warn logging level if this level is enabled. More... | |
virtual void | error (const std::string &msg) |
Logs a message with error logging level if this level is enabled. More... | |
virtual void | fatal (const std::string &msg) |
Logs a message with fatal logging level if this level is enabled. More... | |
level checks | |
Methods are mapped to calls on getLevel. | |
virtual bool | isTraceEnabled () const |
virtual bool | isDebugEnabled () const |
virtual bool | isInfoEnabled () const |
virtual bool | isWarnEnabled () const |
virtual bool | isErrorEnabled () const |
virtual bool | isFatalEnabled () const |
virtual bool | isEnabledFor (const Level &level) const |
Static Public Member Functions | |
static LoggerPtr | getLogger (const std::string &name) |
Returns a logger for the given name. More... | |
Interface for logging adapters that can be used with RSC.
The interface mimics the log4cxx interface. Loggers must be reentrant!
Even though loggers are hierarchical, this hierarchy is maintained externally. Hence, implementations of this class do not need to interpret the name they get assigned and each Logger always gets a level.
|
virtual |
Definition at line 36 of file Logger.cpp.
|
virtual |
Logs a message with debug logging level if this level is enabled.
msg | message to log |
Definition at line 47 of file Logger.cpp.
|
virtual |
Logs a message with error logging level if this level is enabled.
msg | message to log |
Definition at line 59 of file Logger.cpp.
|
virtual |
Logs a message with fatal logging level if this level is enabled.
msg | message to log |
Definition at line 63 of file Logger.cpp.
|
pure virtual |
Returns the currently defined level of the logger.
Implemented in rsc::logging::LoggerProxy, and rsc::logging::ConsoleLogger.
|
static |
Returns a logger for the given name.
The initial log level of the logger is defined by the global configuration.
Receiving a logger is a quite expensive operation if a logger with the specified name did not exist before at runtime. Hence, do not use constantly changing names for loggers with a short lifetime.
name | name of the logger |
Definition at line 39 of file Logger.cpp.
Referenced by rsc::logging::OptionBasedConfigurator::handleOption().
|
pure virtual |
Returns the hierarchical name of the logger.
Implemented in rsc::logging::LoggerProxy, and rsc::logging::ConsoleLogger.
|
virtual |
Logs a message with info logging level if this level is enabled.
msg | message to log |
Definition at line 51 of file Logger.cpp.
|
virtual |
Definition at line 71 of file Logger.cpp.
|
virtual |
Definition at line 91 of file Logger.cpp.
Referenced by rsc::logging::ConsoleLogger::log().
|
virtual |
Definition at line 83 of file Logger.cpp.
|
virtual |
Definition at line 87 of file Logger.cpp.
|
virtual |
Definition at line 75 of file Logger.cpp.
|
virtual |
Definition at line 67 of file Logger.cpp.
|
virtual |
Definition at line 79 of file Logger.cpp.
|
pure virtual |
Logs a message with the given level if it is enabled.
level | level for the message |
msg | message to log |
Implemented in rsc::logging::LoggerProxy.
|
pure virtual |
Defines the level of the logger.
level | new level |
Implemented in rsc::logging::LoggerProxy.
|
pure virtual |
Sets the name of the logger.
name | new name |
Implemented in rsc::logging::LoggerProxy, and rsc::logging::ConsoleLogger.
|
virtual |
Logs a message with trace logging level if this level is enabled.
msg | message to log |
Definition at line 43 of file Logger.cpp.
|
virtual |
Logs a message with warn logging level if this level is enabled.
msg | message to log |
Definition at line 55 of file Logger.cpp.