toLevelStr() static method from fcf::NTest::Logger class
Class:
Package: fcfTest
File: test.hpp ( link_to_the_declaration_in_the_file , link_to_the_implementation_in_the_file )
Available from version: 1.0.1
Converts an
The
Result
- A pointer to a static string (e.g., "def" , "off" , "ftl" , "err" , "wrn" , "att" , "log" , "inf" , "dbg" , "trc" , "all" ).
Detailed description
Mapping Table
| -> | |
| -> | |
| -> | |
| -> | |
| -> | |
| -> | |
| -> | |
| -> | |
| -> | |
| -> | |
| -> |
Example: Basic Conversion
Output:
Current level: dbg
Example: Integration in Custom Prefixes
fcf::NTest::Logger::Prefix dynamicPrefix;
dynamicPrefix.name = "log-level";
dynamicPrefix.multiLine = false;
dynamicPrefix.category = fcf::NTest::LMC_ALL;
dynamicPrefix.handler = []( fcf::NTest::Logger& a_logger, fcf::NTest::Logger::MessageContext& a_context) {
return "[" + fcf::NTest::Logger::toLevelStr (a_context.level) + "] ";
};
fcf::NTest::logger ().appendPrefix (dynamicPrefix);
fcf::NTest::err () << "Critical failure!" << std::endl;
Output:
[err] Critical failure!
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.