Skip to content

Commit

Permalink
iox-eclipse-iceoryx#1755 Flush TestingLogger on terminate
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Nov 14, 2022
1 parent 47feaef commit d471fe2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions iceoryx_hoofs/testing/testing_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ void LogPrinter::OnTestStart(const ::testing::TestInfo&)
dynamic_cast<TestingLogger&>(log::Logger::get()).clearLogBuffer();
TestingLogger::setLogLevel(log::LogLevel::TRACE);

std::set_terminate([]() {
std::cout << "Terminate called\n" << std::flush;
dynamic_cast<TestingLogger&>(log::Logger::get()).printLogBuffer();
std::abort();
});

/// @todo iox-#1755 register signal handler for sigterm to flush to logger;
/// there might be tests to register a handler itself and when this is
/// done at each start of the test only the tests who use their
Expand Down

0 comments on commit d471fe2

Please sign in to comment.