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

err() method from fcf::NTest::Logger class

std::ostream& err()

Class: fcf::NTest::Logger

Package: fcfTest

File: test.hpp

Available from version: 1.0.1

Returns a reference to the output stream for error-level log messages. This level is used to report significant issues that do not necessarily terminate the application

The message will only be written to the output if the current logger threshold is set to fcf::NTest::LL_ERR or upper (e.g., fcf::NTest::LL_ALL, fcf::NTest::LL_WRN, fcf::NTest::LL_ATT, fcf::NTest::LL_LOG, fcf::NTest::LL_INF, fcf::NTest::LL_DBG, fcf::NTest::LL_TRC).

Result
std::ostream&
- A reference to the stream used for error logging. If the log level is too low, this returns a reference to an empty stream buffer (which does not perform any action.).

Example: Basic Error Logging

#define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp> int main() { // This will be printed because the default level is fcf::NTest::LL_LOG (which includes fcf::NTest::LL_ERR) fcf::NTest::logger().err() << "CRITICAL: Database connection lost!" << std::endl; return 0; }

Output:

CRITICAL: Database connection lost!