diff options
author | Chris Wilson <chris+github@qwirx.com> | 2007-08-02 23:28:17 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2007-08-02 23:28:17 +0000 |
commit | 747589f03a1ba61273d21ed6446ad47841a1f46a (patch) | |
tree | c354364468b80aaf25b4522ebbe5e45a97911822 /lib/common/Logging.cpp | |
parent | c0f0b74c04054ddab5610cba9d2268c04c6a7e9f (diff) |
Convert most printf() and fprintf() calls to use logging framework
instead. (refs #3)
Diffstat (limited to 'lib/common/Logging.cpp')
-rw-r--r-- | lib/common/Logging.cpp | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/lib/common/Logging.cpp b/lib/common/Logging.cpp index eee05ba3..d22db238 100644 --- a/lib/common/Logging.cpp +++ b/lib/common/Logging.cpp @@ -243,6 +243,23 @@ bool Console::Log(Log::Level level, const std::string& rFile, { msg += "[" + sTag + "] "; } + + if (level <= Log::FATAL) + { + msg += "FATAL: "; + } + else if (level <= Log::ERROR) + { + msg += "ERROR: "; + } + else if (level <= Log::WARNING) + { + msg += "WARNING: "; + } + else if (level <= Log::NOTICE) + { + msg += "NOTICE: "; + } msg += rMessage; @@ -272,8 +289,29 @@ bool Syslog::Log(Log::Level level, const std::string& rFile, case Log::TRACE: /* fall through */ case Log::EVERYTHING: syslogLevel = LOG_DEBUG; break; } - - syslog(syslogLevel, "%s", rMessage.c_str()); + + std::string msg; + + if (level <= Log::FATAL) + { + msg = "FATAL: "; + } + else if (level <= Log::ERROR) + { + msg = "ERROR: "; + } + else if (level <= Log::WARNING) + { + msg = "WARNING: "; + } + else if (level <= Log::NOTICE) + { + msg = "NOTICE: "; + } + + msg += rMessage; + + syslog(syslogLevel, "%s", msg.c_str()); return true; } |