Controls the logging facility. More...
#include <ndn-cxx/util/logging.hpp>
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 boost::shared_ptr< boost::log::sinks::sink > | makeDefaultStreamDestination (shared_ptr< std::ostream > os, bool wantAutoFlush=true) |
Create stream log destination using default formatting. More... | |
static void | setDestination (boost::shared_ptr< boost::log::sinks::sink > destination) |
Set or replace log destination. More... | |
static void | setDestination (std::ostream &os, bool wantAutoFlush) |
Helper method to set stream log destination. More... | |
static void | setLevel (const std::string &config) |
Set severity levels with a config string. More... | |
static void | setLevel (const std::string &prefix, LogLevel level) |
Set severity level. More... | |
Controls the logging facility.
Definition at line 46 of file logging.hpp.
|
inlinestatic |
Flush log backend.
This ensures all log messages are written to the destination stream.
Definition at line 218 of file logging.hpp.
|
inlinestatic |
Get list of all registered logger names.
Definition at line 194 of file logging.hpp.
|
static |
Create stream log destination using default formatting.
Definition at line 275 of file logging.cpp.
|
inlinestatic |
Set or replace log destination.
destination | log backend, e.g., returned by makeDefaultStreamDestination() |
The initial destination is std::clog
.
Note that if destination
is nullptr, the destination will be removed and the application is expected to add its own. If the application does not set a custom destination (using this function or directly using Boost.Log routines), the default Boost.Log destination will be used. Refer to Boost.Log documentation and source code for details.
Definition at line 212 of file logging.hpp.
|
static |
Helper method to set stream log destination.
os | a stream for log output; caller must ensure it remains valid until setDestination() is invoked again or program exits |
wantAutoFlush | if true, the created logging sink will be auto-flushed |
This is equivalent to setDestination(makeDefaultStreamDestination(shared_ptr<std::ostream>(&os, nullDeleter)))
.
Definition at line 251 of file logging.cpp.
|
inlinestatic |
Set severity levels with a config string.
config | colon-separated key=value pairs |
std::invalid_argument | config string is malformed |
is equivalent to:
Definition at line 206 of file logging.hpp.
|
inlinestatic |
Set severity level.
prefix | logger 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 |
level | minimum 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 200 of file logging.hpp.