|
pflib v3.9.0-rc3-11-g2537d8f
Pretty Fine HGCROC Interaction Library
|
hold logging infrastructure in namespace More...
Classes | |
| struct | fixture |
| a "fixture" that opens the logging when it is created and closes the logging when it is destroyed. More... | |
| class | MessageFormatter |
Typedefs | |
| using | logger |
| our logger type | |
Enumerations | |
| enum | level { trace = -1 , debug = 0 , info = 1 , warn = 2 , error = 3 , fatal = 4 } |
| logging severity labels and their corresponding integers | |
Functions | |
| level | convert (int i_lvl) |
| convert an integer to the severity level enum | |
| logger | get (const std::string &name) |
| Gets a logger with the input name for its channel. | |
| template<typename T > | |
| const T & | safe_extract (boost::log::attribute_value attr) |
| Safely extract a value from the Boost.Log attribute. | |
| void | open (bool color) |
| Initialize the logging backend. | |
| void | set (level lvl, const std::string &only="") |
| Change the level for the logs. | |
| void | close () |
| Close up the logging. | |
Variables | |
| static level | default_level = level::info |
| the default level to apply regardless of settings | |
| static std::unordered_map< std::string, level > | custom_levels |
| custom levels to apply to specific channels | |
hold logging infrastructure in namespace
| using pflib::logging::logger |
our logger type
holds a severity level and a channel name in addition to the other default attributes.
| level pflib::logging::convert | ( | int | i_lvl | ) |
convert an integer to the severity level enum
Any integer below -1 is set to trace and any integer above four is set to fatal.
| [in] | i_lvl | integer level to be converted |
| logger pflib::logging::get | ( | const std::string & | name | ) |
Gets a logger with the input name for its channel.
We maintain a cache of channel-names to loggers so that multiple locations can share the same channel; however, the calls to this function should be minimized in order to avoid wasting time looking up the logger in the cache, making copies of a logger, or creating a new one.
| name | name of this logging channel |
| void pflib::logging::open | ( | bool | color | ) |
Initialize the logging backend.
This function sets up the sinks for the logs (e.g. terminal output) and sets the format and filtering.
The formatting is set once and can support coloring the messages using ANSI escape sequences.
| const T & pflib::logging::safe_extract | ( | boost::log::attribute_value | attr | ) |
Safely extract a value from the Boost.Log attribute.
If the attribute has not been set, then we return a default constructed version of the value.
| void pflib::logging::set | ( | level | lvl, |
| const std::string & | only = "" ) |
Change the level for the logs.
| [in] | lvl | level (and above) to include in messages |
| [in] | only | channel name to apply the level to |