| 76 | } |
| 77 | |
| 78 | BOOST_FIXTURE_TEST_CASE(logging_LogPrintf_, LogSetup) |
| 79 | { |
| 80 | LogPrintf_("fn1", "src1", 1, BCLog::LogFlags::NET, BCLog::Level::Debug, "foo1: %s", "bar1\n"); |
| 81 | LogPrintf_("fn2", "src2", 2, BCLog::LogFlags::NET, BCLog::Level::None, "foo2: %s", "bar2\n"); |
| 82 | LogPrintf_("fn3", "src3", 3, BCLog::LogFlags::NONE, BCLog::Level::Debug, "foo3: %s", "bar3\n"); |
| 83 | LogPrintf_("fn4", "src4", 4, BCLog::LogFlags::NONE, BCLog::Level::None, "foo4: %s", "bar4\n"); |
| 84 | std::ifstream file{tmp_log_path}; |
| 85 | std::vector<std::string> log_lines; |
| 86 | for (std::string log; std::getline(file, log);) { |
| 87 | log_lines.push_back(log); |
| 88 | } |
| 89 | std::vector<std::string> expected = { |
| 90 | "[src1:1] [fn1] [net:debug] foo1: bar1", |
| 91 | "[src2:2] [fn2] [net] foo2: bar2", |
| 92 | "[src3:3] [fn3] [debug] foo3: bar3", |
| 93 | "[src4:4] [fn4] foo4: bar4", |
| 94 | }; |
| 95 | BOOST_CHECK_EQUAL_COLLECTIONS(log_lines.begin(), log_lines.end(), expected.begin(), expected.end()); |
| 96 | } |
| 97 | |
| 98 | BOOST_FIXTURE_TEST_CASE(logging_LogPrintMacros, LogSetup) |
| 99 | { |
nothing calls this directly
no test coverage detected