1#include <boost/test/detail/log_level.hpp>
2#include <boost/test/tools/fpc_tolerance.hpp>
3#include <boost/test/tree/test_unit.hpp>
4#include <boost/test/unit_test.hpp>
5#include <boost/test/unit_test_parameters.hpp>
6#include <boost/test/unit_test_suite.hpp>
36 namespace bu = boost::unit_test;
37#if BOOST_VERSION == 106900 || __APPLE__ && __MACH__
38 std::cerr <<
"Boost 1.69 and macOS get log_level is broken, preCICE log level set to debug.\n";
39 return bu::log_successful_tests;
41 return bu::runtime_config::get<bu::log_level>(bu::runtime_config::btrt_log_level);
47 namespace bu = boost::unit_test;
49 if (logLevel == bu::log_successful_tests || logLevel == bu::log_test_units) {
50 return "%Severity% >= debug";
52 if (logLevel == bu::log_messages) {
53 return "%Severity% >= info";
55 if (logLevel == bu::log_warnings) {
56 return "%Severity% >= warning";
59 return "%Severity% >= warning";
67 if (logConfigs.empty()) {
74 const std::string prefix{
"%TimeStamp(format=\"%H:%M:%S.%f\")%|%Participant%|%Rank%|%Module%|l%Line%|%Function%|"};
78 config.
type =
"stream";
85 config.
output =
"test.log";
89 config.
output =
"test.debug.log";
90 config.
filter =
"%Severity% >= debug";
BOOST_TEST_GLOBAL_FIXTURE(PreciceTestLoggingFixture)
void setupLogging(LoggingConfiguration configs, bool enabled)
Configures the logging from a LoggingConfiguration.
LoggingConfiguration readLogConfFile(std::string const &filename)
Reads a log file, returns a logging configuration.
contains the testing framework.
boost::unit_test::log_level getBoostTestLogLevel()
Boost test Initialization function.
std::string filterFromLogLevel(boost::unit_test::log_level logLevel)
Holds the configuration for one logging backend (sink) and takes care of default values.