nidas  v1.2-1520
Functions
Logging Configuration Schemes

The Logging facility can store multiple logging configuration schemes, each with a particular name. More...

Functions

static void nidas::util::Logger::setScheme (const std::string &name)
 Set the current scheme. More...
 
static void nidas::util::Logger::setScheme (const LogScheme &scheme)
 Set the current scheme to the given scheme. More...
 
static void nidas::util::Logger::updateScheme (const LogScheme &scheme)
 Update or insert this scheme in the collection of log schemes. More...
 
static LogScheme nidas::util::Logger::getScheme (const std::string &name)
 Get the scheme with the given name. More...
 
static LogScheme nidas::util::Logger::getScheme ()
 Return the current LogScheme, creating the default LogScheme if it has not been set yet. More...
 
static bool nidas::util::Logger::knownScheme (const std::string &name)
 Return true if the scheme with the given name is known, false otherwise. More...
 
static void nidas::util::Logger::clearSchemes ()
 Erase all known schemes and reset the active scheme to the name initialized at application start. More...
 

Detailed Description

The Logging facility can store multiple logging configuration schemes, each with a particular name.

The Logger class provides static methods to update the schemes and switch the active scheme. At any time the logging configuration can switch schemes by calling setScheme(). The first time a new scheme name is referenced, a default LogScheme is created with that name. A default LogScheme contains a single LogConfig to enable all messages with level LOGGER_WARNING and above. This is different than the empty LogScheme created by the default LogScheme constructor. If no LogScheme is set by an application, then a default LogScheme is used, with an empty name.

Function Documentation

void Logger::clearSchemes ( )
static

Erase all known schemes and reset the active scheme to the name initialized at application start.

References current_scheme, get_scheme(), log_schemes, and nidas::util::Logger::mutex.

LogScheme Logger::getScheme ( const std::string &  name)
static

Get the scheme with the given name.

If the name does not exist, a default scheme is created, added to the known schemes, then returned. There is no default for name, pass an empty string to lookup a scheme with an empty name. See getScheme().

References get_scheme(), and nidas::util::Logger::mutex.

Referenced by main(), TeeI2C::run(), and nidas::core::SampleTracer::SampleTracer().

LogScheme Logger::getScheme ( )
static

Return the current LogScheme, creating the default LogScheme if it has not been set yet.

References current_scheme, and nidas::util::Logger::mutex.

Referenced by nidas::dynld::GPS_NMEA_Serial::GPS_NMEA_Serial(), parseRunstring(), and nidas::core::SampleSorter::SampleSorter().

bool Logger::knownScheme ( const std::string &  name)
static

Return true if the scheme with the given name is known, false otherwise.

Applications can use this to create a specific default scheme by name if it has not been setup yet. This does not change the current scheme, and it does not create a scheme if the name does not exist yet. There is no default for name. Pass an empty string to lookup a scheme with an empty name.

References lookup_scheme(), and nidas::util::Logger::mutex.

void Logger::setScheme ( const std::string &  name)
static

Set the current scheme.

If a scheme named name does not exist and name is non-empty, a default scheme is created with this name. The name can be empty, and like for any other name, the set scheme will replace any existing scheme with that name.

References current_scheme, get_scheme(), log_points, nidas::util::Logger::mutex, and nidas::util::LoggerPrivate::reconfig().

Referenced by main(), PacketDecode::parseRunstring(), parseRunstring(), TeeTTy::run(), and TeeI2C::run().

void Logger::setScheme ( const LogScheme scheme)
static

Set the current scheme to the given scheme.

The scheme is first added with updateScheme(), then it becomes the current scheme.

References current_scheme, nidas::util::LogScheme::getName(), log_points, log_schemes, nidas::util::Logger::mutex, and nidas::util::LoggerPrivate::reconfig().

void Logger::updateScheme ( const LogScheme scheme)
static

Update or insert this scheme in the collection of log schemes.

If a scheme already exists with the same name, this scheme will replace it. If the given scheme has the same name as the current scheme, then all the log points will be reconfigured according to the new scheme.

References current_scheme, nidas::util::LogScheme::getName(), log_points, log_schemes, nidas::util::Logger::mutex, and nidas::util::LoggerPrivate::reconfig().

Referenced by LogSchemeFromDOMElement().