diff options
Diffstat (limited to 'src/common/logging/backend.cpp')
-rw-r--r-- | src/common/logging/backend.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 242914c6a..ed1e93cc2 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -5,6 +5,7 @@ #include <algorithm> #include <array> #include <chrono> +#include <climits> #include <condition_variable> #include <memory> #include <thread> @@ -83,8 +84,10 @@ private: } }; while (true) { - std::unique_lock<std::mutex> lock(message_mutex); - message_cv.wait(lock, [&] { return !running || message_queue.Pop(entry); }); + { + std::unique_lock<std::mutex> lock(message_mutex); + message_cv.wait(lock, [&] { return !running || message_queue.Pop(entry); }); + } if (!running) { break; } @@ -92,7 +95,7 @@ private: } // Drain the logging queue. Only writes out up to MAX_LOGS_TO_WRITE to prevent a case // where a system is repeatedly spamming logs even on close. - constexpr int MAX_LOGS_TO_WRITE = 100; + const int MAX_LOGS_TO_WRITE = filter.IsDebug() ? INT_MAX : 100; int logs_written = 0; while (logs_written++ < MAX_LOGS_TO_WRITE && message_queue.Pop(entry)) { write_logs(entry); @@ -282,4 +285,4 @@ void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename, Impl::Instance().PushEntry(std::move(entry)); } -} // namespace Log
\ No newline at end of file +} // namespace Log |