Class: fcf::NTest::Logger
Package: fcfTest
File: test.hpp
Available from version: 1.0.1
Returns a pointer to a static string representing the current log level name
The getLevelStr() method converts the current fcf::NTest::ELogLevel of the logger into its human-readable string representation ("off", "ftl", "err", "wrn", "att", "log", "inf", "dbg", "trc", "all"). This is useful for logging the current verbosity level or for debugging the logger's state
Result
const char*
- A pointer to a static string containing the level name
Example: Printing the current log level
fcf::NTest::logger().setLevelStr("dbg");
std::cout << "Current log level: " << fcf::NTest::logger().getLevelStr() << std::endl;
// Output: Current log level: dbg
Example: Using within a custom prefix
fcf::NTest::logger().addedPrefixFunc([]( fcf::NTest::Logger& a_logger, fcf::NTest::ELogLevel a_level) {
return "[" + std::string(a_logger.getLevelStr()) + "] ";
});
fcf::NTest::log() << "Message with level in prefix." << std::endl;