name from class fcf::NTest::Logger::OutputTarget
Property: name
Type:
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.1.13
A unique identifier for the output target.
The
Example: Identifying Output Targets
Demonstrating how to assign a unique name to an
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
#include <iostream>
FCF_TEST_DEFINE ("NameDemo", "Logger", "TargetNaming") {
fcf::NTest::Logger & logger = fcf::NTest::logger ();
// 1. Create a new output target
fcf::NTest::Logger::OutputTarget myTarget;
// 2. Assign a unique name to this target
myTarget.name = "custom_console";
// 3. Configure the target to use std::cout
myTarget.stream = &std::cout;
// 4. Add the target to the logger
logger.targets ({myTarget});
fcf::NTest::log () << "Target with name 'custom_console' is active." << std::endl;
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: "NameDemo" -> "Logger" -> "TargetNaming" ...
> Target with name 'custom_console' is active.
[SUCCESS] Test completed successfully (0.000`005`500 sec)
[SUCCESS] All tests were completed.
Tests: 1 passed, 0 failed, 0 skipped, 1 total
Duration: 0.000`005`500 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.