Browse Source

Fixed report handler behavior when having SC_STOP action so that spdlog handler gets flushed

master
Eyck Jentzsch 9 months ago
parent
commit
469bf27911
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      src/report.cpp

+ 6
- 1
src/report.cpp View File

@ -190,7 +190,12 @@ inline void log2logger(spdlog::logger& logger, logging::log_level lvl, const str
void report_handler(const sc_report &rep, const sc_actions &actions) {
if (actions & SC_DISPLAY) log2logger(*log_cfg.console_logger, rep);
if ((actions & SC_LOG) && log_cfg.file_logger) log2logger(*log_cfg.file_logger, rep);
if (actions & SC_STOP) if(sc_is_running()) sc_stop();
if (actions & SC_STOP) {
if(sc_is_running()) sc_stop();
log_cfg.console_logger->flush();
if(log_cfg.file_logger) log_cfg.file_logger->flush();
this_thread::sleep_for(chrono::milliseconds(10));
}
if (actions & SC_ABORT) {
log_cfg.console_logger->flush();
if(log_cfg.file_logger) log_cfg.file_logger->flush();

Loading…
Cancel
Save