levelStr() method from fcf::NTest::Logger class
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.0.4
Returns or sets a new log level value in string format
Returns a pointer to a static string representing the current log level name
The
Sets the logger's verbosity threshold using a string identifier (e.g.,
Arguments
- A pointer to a null-terminated string representing the desired log level. Valid identifiers include: "off" , "ftl" , "err" , "wrn" , "att" , "log" , "inf" , "dbg" , "trc" , "all" .
Result
- A pointer to a static string containing the level name
Example: Printing the current log level
Example: Using within a custom prefix
Example: Simple recording
Switching the logger to debug mode using a string.
// Set level to Debug
fcf::NTest::logger ().levelStr ("dbg");
fcf::NTest::dbg () << "Debug information is now visible." << std::endl;
Example: Integration with command-line logic
Commonly used when parsing configuration or command-line arguments to set verbosity
std::string userConfiguredLevel = "err";
fcf::NTest::logger ().levelStr (userConfiguredLevel.c_str());
fcf::NTest::inf () << "This message will not be displayed.";
fcf::NTest::err () << "This message will be displayed.";
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.