From b5df385111241e14fcee20795b8c0a88431ffdbb Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 12 Oct 2018 14:11:41 +0400 Subject: [PATCH] Allow apps without logging system to display log messages --- components/debug/debuglog.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/debug/debuglog.hpp b/components/debug/debuglog.hpp index f4a8e17be..f5cdffeda 100644 --- a/components/debug/debuglog.hpp +++ b/components/debug/debuglog.hpp @@ -8,12 +8,13 @@ namespace Debug { enum Level { - NoLevel = 0, Error = 1, Warning = 2, Info = 3, Verbose = 4, - Marker = Verbose + Marker = Verbose, + + NoLevel = 5 // Do not filter messages in this case }; extern Level CurrentDebugLevel; @@ -30,6 +31,11 @@ public: mLock(sLock), mLevel(level) { + // If the app has no logging system enabled, log level is not specified. + // Show all messages without marker - we just use the plain cout in this case. + if (Debug::CurrentDebugLevel == Debug::NoLevel) + return; + if (mLevel <= Debug::CurrentDebugLevel) std::cout << static_cast(mLevel); }