FREEDM DGI
Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members
freedm::broker::CGlobalLogger Class Reference

Tracks the global logging configuration.

#include <CLogger.hpp>

Inheritance diagram for freedm::broker::CGlobalLogger:

Public Member Functions

unsigned int GetOutputLevel (const std::string logger) const
 Fetch the logging level of a specific logger. More...
 
void ListLoggers () const
 Lists all the avaible loggers and their current levels. More...
 
void RegisterLocalLogger (const std::string logger)
 Register a local logger with the global logger. More...
 
void SetGlobalLevel (const unsigned int level)
 Sets the logging level of all loggers. More...
 
void SetInitialLoggerLevels (const std::string loggerCfgFile)
 Reads the logging levels of all loggers from the config file. More...
 
void SetOutputLevel (const std::string logger, const unsigned int level)
 Sets the logging level of a specific logger. More...
 

Static Public Member Functions

static CGlobalLoggerinstance ()
 Retrieves the singleton instance of the global logger. More...
 

Private Types

typedef std::map< const std::string, unsigned int > OutputMap
 Type of container for the output levels. More...
 

Private Attributes

unsigned int m_default
 What the output level is if not set specifically. More...
 
OutputMap m_loggers
 The map of loggers to logger levels. More...
 

Member Typedef Documentation

typedef std::map< const std::string, unsigned int > freedm::broker::CGlobalLogger::OutputMap
private

Member Function Documentation

unsigned int freedm::broker::CGlobalLogger::GetOutputLevel ( const std::string  logger) const

CGlobalLogger::GetOutputLevel

Description:
Gets the output level of the specified logger.
Precondition:
None
Postcondition:
Throws an exception if the specified logger does not exist.
Parameters
loggerthe name of the logger to fetch the output level for.
Returns
The output level of the logger.
CGlobalLogger & freedm::broker::CGlobalLogger::instance ( )
static
Description:
The GlobalLogger is responsible for tracking a table which lists the names of the different loggers and their current output levels.
Limitations:
Singleton. Cannot be copied.

CGlobalLogger::instance

Description:
Gets the global logger which stores the configuration info for the other loggers.
Precondition:
None
Postcondition:
None
Returns
The instance of the global logger.
void freedm::broker::CGlobalLogger::ListLoggers ( ) const

CGlobaLogger::ListLoggers

Description:
Prints a list of the loggers and their level to stdout.
Precondition:
None
Postcondition:
The registered loggers and their current level are printed to stdout.
void freedm::broker::CGlobalLogger::RegisterLocalLogger ( const std::string  logger)

CGlobalLogger::RegisterLocalLogger

Description:
Registers a local logger with the global logger so it can be enumerated for functions like SetGlobalLevel.
Precondition:
None
Postcondition:
The loggers name is added to the loggers table.
Parameters
loggerthe name of the CLogger being added.
void freedm::broker::CGlobalLogger::SetGlobalLevel ( const unsigned int  level)

CGlobalLogger::SetGlobalLevel

Description:
For reach logger that the GlobalLogger is aware of set the loggers level to the specified value
Precondition:
None
Postcondition:
Every logger's log level is changed to level.
Parameters
levelThe new desired log level.
void freedm::broker::CGlobalLogger::SetInitialLoggerLevels ( const std::string  loggerCfgFile)

CGlobalLogger::SetInitialLoggerLevels

Description:
Sets the logger verbosity levels to the values specified as default or in one of the configuration files.
Precondition:
None
Postcondition:
Logger levels are set to the levels specified in the logger config file. Exceptions may be thrown if the file is not correctly formatted or contains invalid entries.
Parameters
loggerCfgFilethe name of the config file to process the values from.
void freedm::broker::CGlobalLogger::SetOutputLevel ( const std::string  logger,
const unsigned int  level 
)

CGlobalLogger::SetOutputLevel

Description:
Sets the output level of the specified logger.
Precondition:
The logger has been registered with the GlobalLogger.
Postcondition:
The logger's level has been set to the specified value.
Parameters
loggerThe name of the logger to modify.
levelThe level the the logger's output should be set to.

Member Data Documentation

unsigned int freedm::broker::CGlobalLogger::m_default
private
OutputMap freedm::broker::CGlobalLogger::m_loggers
private

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