ndn::util::Logging Class Reference

Controls the logging facility. More...

#include <logging.hpp>

+ Inheritance diagram for ndn::util::Logging:
+ Collaboration diagram for ndn::util::Logging:

Static Public Member Functions

static void flush ()
 Flush log backend. More...
 
static std::set< std::string > getLoggerNames ()
 Get list of all registered logger names. More...
 
static void setDestination (shared_ptr< std::ostream > os)
 Set log destination. More...
 
static void setDestination (std::ostream &os)
 Set log destination. More...
 
static void setLevel (const std::string &prefix, LogLevel level)
 Set severity level. More...
 
static void setLevel (const std::string &config)
 Set severity levels with a config string. More...
 

Detailed Description

Controls the logging facility.

Note
Public static methods are thread safe. Non-public methods are not guaranteed to be thread safe.

Definition at line 46 of file logging.hpp.

Member Function Documentation

void ndn::util::Logging::flush ( )
inlinestatic

Flush log backend.

This ensures all log messages are written to the destination stream.

Definition at line 204 of file logging.hpp.

std::set< std::string > ndn::util::Logging::getLoggerNames ( )
inlinestatic

Get list of all registered logger names.

Definition at line 180 of file logging.hpp.

void ndn::util::Logging::setDestination ( shared_ptr< std::ostream >  os)
inlinestatic

Set log destination.

Parameters
osa stream for log output

The initial destination is std::clog.

Definition at line 198 of file logging.hpp.

void ndn::util::Logging::setDestination ( std::ostream &  os)
static

Set log destination.

Parameters
osa stream for log output; caller must ensure it remains valid until setDestination() is invoked again or program exits

This is equivalent to setDestination(shared_ptr<std::ostream>(&os, nullDeleter)).

Definition at line 203 of file logging.cpp.

void ndn::util::Logging::setLevel ( const std::string &  prefix,
LogLevel  level 
)
inlinestatic

Set severity level.

Parameters
prefixlogger prefix; this can be a specific logger name, a general prefix like "ndn.a.*" to apply a setting for all modules that contain that prefix, or "*" for all modules
levelminimum severity level

Log messages are output only if their severity is greater than the current minimum severity level. The initial severity level is LogLevel::NONE, which enables FATAL messages only.

Definition at line 186 of file logging.hpp.

void ndn::util::Logging::setLevel ( const std::string &  config)
inlinestatic

Set severity levels with a config string.

Parameters
configcolon-separated key=value pairs
Exceptions
std::invalid_argumentconfig string is malformed
Logging::setLevel("*=INFO:Face=DEBUG:NfdController=WARN");

is equivalent to:

Definition at line 192 of file logging.hpp.