RSC  0.17.1
rsc::logging::OptionBasedConfigurator Class Reference

A class which configures the logging tree using configuration subsystem of RSC. More...

#include <OptionBasedConfigurator.h>

Inheritance diagram for rsc::logging::OptionBasedConfigurator:
Inheritance graph
Collaboration diagram for rsc::logging::OptionBasedConfigurator:
Collaboration graph

Public Member Functions

 OptionBasedConfigurator (const std::vector< std::string > &rootOption=getDefaultRootOption())
 Constructs a new configurator with a specified root option. More...
 
virtual ~OptionBasedConfigurator ()
 Destructor. More...
 
std::vector< std::string > getRootOption () const
 Returns the option root used by this configurator. More...
 
virtual void handleOption (const std::vector< std::string > &key, const std::string &value)
 This method is called once for each individual option available from a given ConfigSource. More...
 
- Public Member Functions inherited from rsc::config::OptionHandler
virtual ~OptionHandler ()
 

Static Public Member Functions

static std::vector< std::string > getDefaultRootOption ()
 Returns the default config entry assumed for the root logger. More...
 

Private Member Functions

bool keyStartWithRoot (const std::vector< std::string > &key) const
 
std::string loggerNameFromKey (const std::vector< std::string > &key) const
 
std::string settingFromKey (const std::vector< std::string > &key) const
 
std::vector< std::string > normalizeKey (const std::vector< std::string > &key) const
 

Private Attributes

std::vector< std::string > rootOption
 

Detailed Description

A class which configures the logging tree using configuration subsystem of RSC.

The usual logging hierarchy is mapped onto the hierarchy of options in the config interface with a prefix to prevent name clashes. This e.g. means that the root logger can be configured with the default prefix rsc.logging. This is called the root option.

This class can be used multiple times. Newer options override older ones.

Author
jwienke

Definition at line 46 of file OptionBasedConfigurator.h.

Constructor & Destructor Documentation

rsc::logging::OptionBasedConfigurator::OptionBasedConfigurator ( const std::vector< std::string > &  rootOption = getDefaultRootOption())

Constructs a new configurator with a specified root option.

Parameters
rootOptionthe root in the option namespace containing the logger configurations

Definition at line 41 of file OptionBasedConfigurator.cpp.

rsc::logging::OptionBasedConfigurator::~OptionBasedConfigurator ( )
virtual

Destructor.

Definition at line 46 of file OptionBasedConfigurator.cpp.

Member Function Documentation

vector< string > rsc::logging::OptionBasedConfigurator::getDefaultRootOption ( )
static

Returns the default config entry assumed for the root logger.

Returns
config option representation of "rsc.logging"

Definition at line 49 of file OptionBasedConfigurator.cpp.

vector< string > rsc::logging::OptionBasedConfigurator::getRootOption ( ) const

Returns the option root used by this configurator.

Parameters
configoption representation for the root option which contains all logging configurations

Definition at line 56 of file OptionBasedConfigurator.cpp.

References rootOption.

void rsc::logging::OptionBasedConfigurator::handleOption ( const std::vector< std::string > &  key,
const std::string &  value 
)
virtual

This method is called once for each individual option available from a given ConfigSource.

Parameters
keyA list of hierarchical key components that identify the option.
valueThe value of the option.

Implements rsc::config::OptionHandler.

Definition at line 96 of file OptionBasedConfigurator.cpp.

References rsc::patterns::Singleton< LoggerFactory >::getInstance(), rsc::logging::Logger::getLogger(), keyStartWithRoot(), rsc::logging::Logger::LEVEL_ALL, rsc::logging::Logger::LEVEL_DEBUG, rsc::logging::Logger::LEVEL_ERROR, rsc::logging::Logger::LEVEL_FATAL, rsc::logging::Logger::LEVEL_INFO, rsc::logging::Logger::LEVEL_OFF, rsc::logging::Logger::LEVEL_TRACE, rsc::logging::Logger::LEVEL_WARN, loggerNameFromKey(), normalizeKey(), and rootOption.

Here is the call graph for this function:

bool rsc::logging::OptionBasedConfigurator::keyStartWithRoot ( const std::vector< std::string > &  key) const
private

Definition at line 60 of file OptionBasedConfigurator.cpp.

References rootOption.

Referenced by handleOption().

Here is the caller graph for this function:

string rsc::logging::OptionBasedConfigurator::loggerNameFromKey ( const std::vector< std::string > &  key) const
private

Definition at line 79 of file OptionBasedConfigurator.cpp.

References rootOption.

Referenced by handleOption().

Here is the caller graph for this function:

vector< string > rsc::logging::OptionBasedConfigurator::normalizeKey ( const std::vector< std::string > &  key) const
private

Definition at line 141 of file OptionBasedConfigurator.cpp.

Referenced by handleOption().

Here is the caller graph for this function:

std::string rsc::logging::OptionBasedConfigurator::settingFromKey ( const std::vector< std::string > &  key) const
private

Member Data Documentation

std::vector<std::string> rsc::logging::OptionBasedConfigurator::rootOption
private

The documentation for this class was generated from the following files: