11 #include <boost/test/unit_test.hpp>
26 using namespace Acts::Logging;
30 std::unique_ptr<const Logger> create_logger(
const std::string& logger_name,
31 std::ostream* logfile,
33 auto output = std::make_unique<LevelOutputDecorator>(
34 std::make_unique<NamedOutputDecorator>(
35 std::make_unique<DefaultPrintPolicy>(logfile), logger_name, 30));
36 auto print = std::make_unique<DefaultFilterPolicy>(lvl);
41 return std::string(
"'") + expected +
"' != '" + found +
"'";
54 std::ofstream logfile(output_file);
59 BOOST_CHECK_THROW(detail::create_logger(
"TestLogger", &logfile, lvl),
71 BOOST_CHECK_THROW(test_operation(), std::runtime_error);
87 padded_name.resize(30,
' ');
90 std::vector<std::string>
lines{padded_name +
"FATAL fatal level",
91 padded_name +
"ERROR error level",
92 padded_name +
"WARNING warning level",
93 padded_name +
"INFO info level",
94 padded_name +
"DEBUG debug level",
95 padded_name +
"VERBOSE verbose level"};
106 auto log = detail::create_logger(
"TestLogger", &logfile, lvl);
107 BOOST_CHECK_EQUAL(log->name(),
"TestLogger");
108 auto copy = log->clone(
"TestLoggerClone");
110 BOOST_CHECK_EQUAL(log->name(),
"TestLogger");
112 auto copy2 = log->clone(
"TestLoggerClone");
113 BOOST_CHECK_EQUAL(copy2->level(), log->level());
115 auto copy3 = log->cloneWithSuffix(
"Suffix");
116 BOOST_CHECK_EQUAL(log->level(), copy3->level());
118 logfile = std::ofstream{output_file};