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

LMC_USER_GROUP from enum fcf::NTest::ELogMessageCategory

Value: fcf::NTest::LMC_USER_GROUP = 0x00080000

Enum: fcf::NTest::ELogMessageCategory

Package: fcfTest

File: test.hpp

Available from version: 1.1.14

The category for user-defined diagnostic messages, allowing developers to inject custom logs into the framework's logging system.

The fcf::NTest::LMC_USER_GROUP category is reserved for messages generated directly by the user's application code. It provides a clean way to separate your own diagnostic information from the internal framework logs (like test lifecycle or results).

By using this category, you can:

  • Apply custom prefixes that only appear for your own logs.
  • Filter out your own logs if they become too verbose, without affecting the visibility of test results.
  • Direct user-specific logs to different output targets or formats.

This category is often used in conjunction with the global shortcut functions like log(), inf(), etc., when you want to ensure your messages are treated as application-level data.

Example: Custom User Logging

Demonstrates how to use the USER_GROUP category to log custom application data and how to apply a unique prefix that only targets these user messages.

#define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp> #include <iostream> FCF_TEST_DECLARE("UserLogDemo", "Custom", "UserPrefixTest") { // 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 applies to the USER_GROUP category // This will make user messages look distinct from system messages. fcf::NTest::Logger::Prefix prefix; prefix.name = "user-tag"; prefix.multiLine = false; prefix.category = fcf::NTest::LMC_USER_GROUP; prefix.prefix = "[APP] "; logger.appendPrefix(prefix); // 4. Log a message using the USER_GROUP category // This message will be prefixed with "[APP] " fcf::NTest::log(fcf::NTest::LMC_USER_GROUP) << "Processing data..." << std::endl; // 5. Log a message using a system category (e.g., LAUNCH_START) // This message will NOT have the "[APP] " prefix fcf::NTest::log(fcf::NTest::LMC_LAUNCH_START) << "System event." << std::endl; // 6. Perform a simple assertion 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: "UserLogDemo" -> "Custom" -> "UserPrefixTest" ... > [APP] Processing data... System event. [SUCCESS] Test completed successfully (0.000`012`518 sec) [SUCCESS] All tests were completed. Tests: 1 passed, 0 failed, 0 skipped, 1 total Duration: 0.000`012`518 sec