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 Feb 6, 2023
1 parent 3a782ad commit 5cf0bdc
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 @@ -117,6 +117,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 5cf0bdc

Please sign in to comment.