RSC  0.16.0
rsc::logging Namespace Reference

Provides a hierarchical logging system with the possibility to install different backends, which are instances of LoggingSystem. More...

Classes

class  ConsoleLogger
 A simple logger that uses cout and cerr for logging. More...
 
class  ConsoleLoggingSystem
 Default logging system using the console for output. More...
 
class  Logger
 Interface for logging adapters that can be used with RSC. More...
 
class  LoggerFactory
 Factory to create logger instances. More...
 
class  LoggerProxy
 A proxy to an instance of Logger, which provides the same interface but allows to exchange the underlying logger at runtime. More...
 
class  LoggerTreeNode
 A simple tree representation for loggers. More...
 
class  LoggingSystem
 Represents a logging adapter available to the rsc logging system through the configuration. More...
 
class  OptionBasedConfigurator
 A class which configures the logging tree using configuration subsystem of RSC. More...
 
class  TreeLevelUpdater
 

Typedefs

typedef boost::shared_ptr< LoggerLoggerPtr
 
typedef boost::shared_ptr< LoggerProxyLoggerProxyPtr
 
typedef boost::shared_ptr< LoggerTreeNodeLoggerTreeNodePtr
 
typedef boost::weak_ptr< LoggerTreeNodeLoggerTreeNodeWeakPtr
 

Functions

ostream & operator<< (ostream &stream, const Logger::Level &level)
 
rsc::misc::Registry< LoggingSystem > * loggingSystemRegistry ()
 

Detailed Description

Provides a hierarchical logging system with the possibility to install different backends, which are instances of LoggingSystem.

The hierarchy is completely maintained by LoggerFactory, hence logging systems only need to provide Logger instances which are configured externally according to the hierarchy.

Conceptually, the hierarchy is based on log4cxx/log4j. We have a root logger with empty string as name. All other loggers are (indirect) children of this logger. Hierarchies are separated by a '.' in the logger name. At startup only the root logger has an assigned level. All other loggers inherit this level if not one of their parents also has a level assigned. Generally, the effective level of a logger is the assigned level of the earliest parent of the logger which actually has an assigned level.

In detail, the logger names have the following conventions and rules:

  • name are handled case-insensitive
  • the part after the last . must not be called "system" or "level" (case-insensitive)
  • you should not include = characters and any kind of line breaks as they might interfere with configuration system

To install new LoggingSystem instances, register them in loggingSystemRegistry. The selection of a logging system can be triggered through LoggerFactory::reselectLoggingSystem using a string as a hint.

As the default, a simple cout- / cerr-based LoggingSystem called ConsoleLoggingSystem is provided.

Typedef Documentation

typedef boost::shared_ptr<LoggerProxy> rsc::logging::LoggerProxyPtr

Definition at line 112 of file LoggerProxy.h.

typedef boost::shared_ptr<Logger> rsc::logging::LoggerPtr

Definition at line 41 of file Logger.h.

typedef boost::shared_ptr<LoggerTreeNode> rsc::logging::LoggerTreeNodePtr

Definition at line 42 of file LoggerTreeNode.h.

Definition at line 44 of file LoggerTreeNode.h.

Function Documentation

RSC_EXPORT rsc::misc::Registry< LoggingSystem > * rsc::logging::loggingSystemRegistry ( )

Definition at line 35 of file LoggingSystem.cpp.

Referenced by rsc::logging::ConsoleLoggingSystem::createLogger(), and rsc::logging::LoggerFactory::reselectLoggingSystem().

Here is the caller graph for this function:

RSC_EXPORT std::ostream & rsc::logging::operator<< ( ostream &  stream,
const Logger::Level level 
)

Definition at line 95 of file Logger.cpp.