diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/common/Logging.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/common/Logging.h b/lib/common/Logging.h index 01358617..3dc3e69c 100644 --- a/lib/common/Logging.h +++ b/lib/common/Logging.h @@ -295,6 +295,32 @@ class Console : public Logger static void SetShowTimeMicros(bool enabled); static void SetShowPID(bool enabled); static bool GetShowTag() { return sShowTag; } + + class SettingsGuard + { + private: + bool mShowTag; + bool mShowTime; + bool mShowTimeMicros; + bool mShowPID; + std::string mTag; + public: + SettingsGuard() + : mShowTag(Console::sShowTag), + mShowTime(Console::sShowTime), + mShowTimeMicros(Console::sShowTimeMicros), + mShowPID(Console::sShowPID), + mTag(Console::sTag) + { } + ~SettingsGuard() + { + Console::SetShowTag(mShowTag); + Console::SetShowTime(mShowTime); + Console::SetShowTimeMicros(mShowTimeMicros); + Console::SetShowPID(mShowPID); + Console::sTag = mTag; + } + }; }; // -------------------------------------------------------------------------- |