Factory to create logger instances.
More...
#include <LoggerFactory.h>
|
static LoggerFactory & | getInstance () |
| Retrieve the singleton instance, creating it if necessary. More...
|
|
static void | killInstance () |
| This function can be used to make sure the instance is deleted at a particular time. More...
|
|
Factory to create logger instances.
On singleton creation selects a logger according to the heuristic mentioned for reselectLoggingSystem.
- Author
- jwienke
Definition at line 81 of file LoggerFactory.h.
rsc::logging::LoggerFactory::LoggerFactory |
( |
| ) |
|
|
private |
rsc::logging::LoggerFactory::~LoggerFactory |
( |
| ) |
|
|
virtual |
void rsc::logging::LoggerFactory::clearKnownLoggers |
( |
| ) |
|
LoggerPtr rsc::logging::LoggerFactory::getLogger |
( |
const std::string & |
name = "" | ) |
|
Get a logger for the given name.
If a logger with this name already exists, the existing instance is returned.
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.
- Parameters
-
name | name of the logger, empty string means root logger |
- Returns
- logger instance
Definition at line 195 of file LoggerFactory.cpp.
string rsc::logging::LoggerFactory::getLoggingSystemName |
( |
| ) |
|
Returns the name of the currently selected logging system.
- Returns
- logging system name
Definition at line 234 of file LoggerFactory.cpp.
void rsc::logging::LoggerFactory::reconfigure |
( |
const Logger::Level & |
level | ) |
|
Simple hack to reconfigure all known loggers and new instances with a logging level.
Only loggers which had a manually assigned level will actually be assigned with the new level. All others use the inheritance tree to get a level. Effectively this will result in all loggers appearing with the same level but semantics for changing certain levels in the logger tree are preserved.
- Parameters
-
level | new level for all loggers |
Definition at line 226 of file LoggerFactory.cpp.
void rsc::logging::LoggerFactory::reconfigureFromFile |
( |
const std::string & |
fileName | ) |
|
void rsc::logging::LoggerFactory::reselectLoggingSystem |
( |
const std::string & |
nameHint = "" | ) |
|
Reselected the automatically chosen logging system to adapt to newly available ones.
A hint can be given on the name of the logging system to select.
If no hint is given the first found logging system which is not the default will be selected. If no such system exists, the default is used. The name hint overrides these settings if a logging system matching the hint is found.
This method will NOT change previously gathered loggers.
- Parameters
-
nameHint | hint for the name of the logging system to select. If the string is empty, it will not be used. If it is DEFAULT_LOGGING_SYSTEM, the default logging system will be selected even if other systems are available. |
Definition at line 156 of file LoggerFactory.cpp.
Default level when the system is used without prior initialization.
Definition at line 152 of file LoggerFactory.h.
const string rsc::logging::LoggerFactory::DEFAULT_LOGGING_SYSTEM = "console" |
|
static |
boost::recursive_mutex rsc::logging::LoggerFactory::mutex |
|
private |
The documentation for this class was generated from the following files: