Implements a generic logging facility. More...
#include <shark/Core/Logger.h>
Collaboration diagram for shark::Logger:Classes | |
| class | AbstractFormatter |
| Entrypoint for extending the logging framework with custom format handlers. More... | |
| class | AbstractHandler |
| Entrypoint for extending the logging framework with custom log handlers. More... | |
| class | Record |
| Models a single log record passed to the logging framework. More... | |
Public Types | |
| enum | Level { DEBUG_LEVEL = 1, INFO_LEVEL = 2, WARNING_LEVEL = 4, ERROR_LEVEL = 8 } |
| Models the different log levels known to the system. More... | |
Public Member Functions | |
| Logger () | |
| template<typename PropertyTree > | |
| void | configure (const PropertyTree &root) |
| void | operator() (const Record &record) |
| Processes the supplied record and passes it to the registered handlers. More... | |
| Level | logLevel () const |
| Accesses the log level of this logger. More... | |
| void | setLogLevel (Level logLevel) |
| Adjusts the log level of this logger. More... | |
| void | registerHandler (const boost::shared_ptr< AbstractHandler > &handler) |
| Registers a handler instance with this logger. More... | |
| void | unregisterHandler (const boost::shared_ptr< AbstractHandler > &handler) |
| Deregisters a handler instance from this logger. More... | |
| bool | hasHandler (const boost::shared_ptr< AbstractHandler > &handler) const |
| Queries this logger instance if the handler is installed. More... | |
Static Public Member Functions | |
| static const std::string & | toString (Level level) |
| Converts the supplied log level to a human-readable string representation. More... | |
| static Level | fromString (const std::string &level) |
| Converts the supplied log level to an element of enumeration log level. More... | |
Static Public Attributes | |
| static lut_type | LEVEL_LUT |
| Default look-up table for Level <-> string conversion. More... | |
Protected Attributes | |
| Level | m_logLevel |
| Log level of the logger instance. More... | |
| boost::unordered_set < boost::shared_ptr < AbstractHandler > > | m_registeredHandlers |
| Hash-set of registered handlers. More... | |
| boost::mutex | m_registeredHandlersGuard |
| Guards the set of registered handlers. More... | |
Implements a generic logging facility.
Simple logging mechanism and a singleton logger pool for logger management:
| enum shark::Logger::Level |
|
inline |
Definition at line 301 of file Logger.h.
References LEVEL_LUT, and m_logLevel.
|
inlinestatic |
Converts the supplied log level to an element of enumeration log level.
| shark::Exception | if the log level is not known. |
Definition at line 106 of file Logger.h.
References LEVEL_LUT, and SHARKEXCEPTION.
|
inline |
Queries this logger instance if the handler is installed.
Definition at line 354 of file Logger.h.
References m_registeredHandlers.
|
inline |
Accesses the log level of this logger.
Definition at line 324 of file Logger.h.
References m_logLevel.
Referenced by operator()(), and setLogLevel().
|
inline |
Processes the supplied record and passes it to the registered handlers.
Definition at line 310 of file Logger.h.
References shark::Logger::Record::logLevel(), logLevel(), m_registeredHandlers, and m_registeredHandlersGuard.
|
inline |
Registers a handler instance with this logger.
Definition at line 338 of file Logger.h.
References m_registeredHandlers, and m_registeredHandlersGuard.
|
inline |
Adjusts the log level of this logger.
Definition at line 331 of file Logger.h.
References logLevel(), and m_logLevel.
|
inlinestatic |
Converts the supplied log level to a human-readable string representation.
| shark::Exception | if log level is not known. |
Definition at line 95 of file Logger.h.
References LEVEL_LUT, and SHARKEXCEPTION.
|
inline |
Deregisters a handler instance from this logger.
Definition at line 346 of file Logger.h.
References m_registeredHandlers, and m_registeredHandlersGuard.
|
static |
Default look-up table for Level <-> string conversion.
Definition at line 89 of file Logger.h.
Referenced by configure(), fromString(), and toString().
|
protected |
Log level of the logger instance.
Definition at line 359 of file Logger.h.
Referenced by configure(), logLevel(), and setLogLevel().
|
protected |
Hash-set of registered handlers.
Definition at line 364 of file Logger.h.
Referenced by hasHandler(), operator()(), registerHandler(), and unregisterHandler().
|
protected |
Guards the set of registered handlers.
Definition at line 365 of file Logger.h.
Referenced by operator()(), registerHandler(), and unregisterHandler().