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

name from class fcf::NTest::Logger::OutputTarget

Property: name

Type: std::string

Class: fcf::NTest::Logger::OutputTarget

Package: fcfTest

File: test.hpp

Available from version: 1.1.13

A unique identifier for the output target.

The name property serves as a unique identifier for a specific output target. This name is used by the fcf::NTest::Logger to manage, retrieve, and differentiate between various targets (e.g., when updating settings for a specific stream or when mapping data factories to specific targets).

Example: Identifying Output Targets

Demonstrating how to assign a unique name to an fcf::NTest::Logger::OutputTarget to manage it within the logger.

#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