setLevelStr() method from fcf::NTest::Logger class
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.0.1
Sets the logger's verbosity threshold using a string identifier (e.g.,
The
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" .
Example: Basic usage
Switching the logger to debug mode using a string.
// Set level to Debug
fcf::NTest::logger ().setLevelStr ("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 ().setLevelStr (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.