diff options
author | Chris Wilson <chris+github@qwirx.com> | 2012-11-27 22:49:18 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2012-11-27 22:49:18 +0000 |
commit | 6f845ef4024cb1f68d3af65580819fdc330b4a90 (patch) | |
tree | 7bcb08435c1a5b71c390b5e42b5ca3e591937e9c /lib/common/Logging.cpp | |
parent | 54cd5a63fb3d7c6d00f60d4383f9193b01dc7968 (diff) |
Allow getting the standard Console and Syslog loggers. Add a Guard class
that can be used to protect against permanent changes to their log levels.
Diffstat (limited to 'lib/common/Logging.cpp')
-rw-r--r-- | lib/common/Logging.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/common/Logging.cpp b/lib/common/Logging.cpp index 7674115e..7ce0dd3f 100644 --- a/lib/common/Logging.cpp +++ b/lib/common/Logging.cpp @@ -253,6 +253,12 @@ Logger::~Logger() Logging::Remove(this); } +bool Logger::IsEnabled(Log::Level level) +{ + return Logging::IsEnabled(level) && + (int)mCurrentLevel >= (int)level; +} + bool Console::sShowTime = false; bool Console::sShowTimeMicros = false; bool Console::sShowTag = false; @@ -364,6 +370,8 @@ bool Console::Log(Log::Level level, const std::string& rFile, #else fprintf(target, "%s\n", buf.str().c_str()); #endif + + fflush(target); return true; } |