FCF 2.0 development in progress...
> > > > >
[News] [C++ Libraries API] [C++ Downloads] [Donate to the project] [Contacts]

LMC_ROOT_GROUP from enum fcf::NTest::ELogMessageCategory

Value: fcf::NTest::LMC_ROOT_GROUP = 0x00010000

Enum: fcf::NTest::ELogMessageCategory

Package: fcfTest

File: test.hpp

Available from version: 1.1.14

The base category for all root-level system messages, including test execution lifecycle, summary, and runner errors.

The fcf::NTest::LMC_ROOT_GROUP is the primary category used to group messages related to the overall test execution process. It serves as a parent category for several important system events, such as:

  • The start and end of the entire test execution process.
  • The final summary of test results (passed, failed, skipped).
  • General errors encountered during the test runner's operation.
  • Execution duration and timing information.

By using this category, developers can apply specific prefixes or filters that target only the high-level orchestration messages of the framework, separating them from individual test case logs or user-defined messages.

Example: Logging Root System Messages

Demonstrates how to manually log a message using the ROOT_GROUP category and how to apply a custom prefix that specifically targets these system-level messages.

#define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp> #include <iostream> FCF_TEST_DECLARE("RootDemo", "System", "ManualRootLog") { // 1. Access the global logger fcf::NTest::Logger& logger = fcf::NTest::logger(); // 2. Clear existing prefixes for a clean demonstration logger.clearPrefixes(true); // 3. Add a custom prefix that ONLY targets the ROOT_GROUP category fcf::NTest::Logger::Prefix prefix; prefix.name = "system-tag"; prefix.multiLine = false; prefix.category = fcf::NTest::LMC_ROOT_GROUP; prefix.prefix = "[SYSTEM] "; logger.appendPrefix(prefix); // 4. Log a message using the ROOT_GROUP category // This message will be intercepted by our custom prefix fcf::NTest::log(fcf::NTest::LMC_ROOT_GROUP) << "Manual root message triggered." << std::endl; // 5. Log a message using a different category (e.g., USER_GROUP) // This message will NOT have the "[SYSTEM]" prefix fcf::NTest::log(fcf::NTest::LMC_USER_GROUP) << "This is a standard user message." << std::endl; // 6. Perform a simple assertion to complete the test FCF_TEST(true); } int main(int a_argc, char* a_argv[]) { bool error = false; fcf::NTest::cmdRun(a_argc, a_argv, fcf::NTest::CRM_RUN, &error); return error ? 1 : 0; }

Output:

Performing the test: "RootDemo" -> "System" -> "ManualRootLog" ... [SYSTEM] Manual root message triggered. > This is a standard user message. [SUCCESS] Test completed successfully (0.000`010`527 sec) [SYSTEM] [SYSTEM] [SUCCESS] All tests were completed. [SYSTEM] Tests: 1 passed, 0 failed, 0 skipped, 1 total [SYSTEM] Duration: 0.000`010`527 sec