Class: fcf::NTest::Logger
Package: fcfTest
File: test.hpp
Available from version: 1.0.1
Converts an fcf::NTest::ELogLevel enumeration value into its corresponding human-readable string representation.
The toLevelStr() method provides a mapping from the fcf::NTest::ELogLevel enum to a static C-style string. This is primarily used for generating descriptive log prefixes or for debugging the current state of the logger.
Result
const char*
- A pointer to a static string (e.g., "def", "off", "ftl", "err", "wrn", "att", "log", "inf", "dbg", "trc", "all").
Detailed description
Mapping Table
fcf::NTest::LL_DEF | -> | "def" |
fcf::NTest::LL_OFF | -> | "off" |
fcf::NTest::LL_FTL | -> | "ftl" |
fcf::NTest::LL_ERR | -> | "err" |
fcf::NTest::LL_WRN | -> | "wrn" |
fcf::NTest::LL_ATT | -> | "att" |
fcf::NTest::LL_LOG | -> | "log" |
fcf::NTest::LL_INF | -> | "inf" |
fcf::NTest::LL_DBG | -> | "dbg" |
fcf::NTest::LL_TRC | -> | "trc" |
fcf::NTest::LL_ALL | -> | "all" |
Example: Basic Conversion
std::cout << "Current level: " << fcf::NTest::Logger::toLevelStr(fcf::NTest::LL_DBG) << std::endl;
Output:
Current level: dbg
Example: Integration in Custom Prefixes
fcf::NTest::logger().addedPrefixFunc([](fcf::NTest::Logger& a_logger, fcf::NTest::ELogLevel a_level) {
return "[" + std::string(fcf::NTest::Logger::toLevelStr(a_level)) + "] ";
});
fcf::NTest::err() << "Critical failure!" << std::endl;
Output:
[err] Critical failure!