diff --git a/src/Lib/Log.hh b/src/Lib/Log.hh index dcb33f6bc2b9922c96cbb6afa5d84e623bb11b2f..b40bac3aaddc8b4b5c13ae729cd0456c709d9f3c 100644 --- a/src/Lib/Log.hh +++ b/src/Lib/Log.hh @@ -10,7 +10,10 @@ #define VIVY_LOG_ERR(log) VIVY_LOG_WITH_LEVEL(log, LogLevel::Error) #define VIVY_LOG_FATAL(log) VIVY_LOG_WITH_LEVEL(log, LogLevel::Critical) -#define VIVY_DCL_LOG_SINK(sink) std::shared_ptr<LogSink> sink{ LogSink::newSink() }; +#define VIVY_DCL_LOG_SINK(sink) \ + std::shared_ptr<LogSink> sink{ LogSink::newSink() }; \ + void flushLogSink() const noexcept { sink->flush(); } + #define VIVY_DCL_LOG_DISPATCH(sink, name, dispatch) \ std::shared_ptr<dispatch> name{ sink->newDispatcher<dispatch>() }; diff --git a/src/VivyApplication.cc b/src/VivyApplication.cc index b312b27c2a41d628d74795ac1c971e20a9efa12c..2020a97b5e349f3c5bd1e6c50e63a240e1dab1a3 100644 --- a/src/VivyApplication.cc +++ b/src/VivyApplication.cc @@ -28,6 +28,8 @@ VivyApplication::setTheme(Theme theme) noexcept setStyleSheet(stylesheetStream.readAll()); logInfo() << "Theme set using " << sheet; } + + flushLogSink(); } int @@ -62,6 +64,7 @@ VivyApplication::exec() noexcept logInfo() << "Entering the main event loop"; // Main loop + flushLogSink(); return QApplication::exec(); }