summaryrefslogtreecommitdiff
path: root/lib/common
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2007-08-02 23:28:17 +0000
committerChris Wilson <chris+github@qwirx.com>2007-08-02 23:28:17 +0000
commit747589f03a1ba61273d21ed6446ad47841a1f46a (patch)
treec354364468b80aaf25b4522ebbe5e45a97911822 /lib/common
parentc0f0b74c04054ddab5610cba9d2268c04c6a7e9f (diff)
Convert most printf() and fprintf() calls to use logging framework
instead. (refs #3)
Diffstat (limited to 'lib/common')
-rw-r--r--lib/common/DebugMemLeakFinder.cpp3
-rw-r--r--lib/common/Logging.cpp42
2 files changed, 42 insertions, 3 deletions
diff --git a/lib/common/DebugMemLeakFinder.cpp b/lib/common/DebugMemLeakFinder.cpp
index a99b2072..e9b0e681 100644
--- a/lib/common/DebugMemLeakFinder.cpp
+++ b/lib/common/DebugMemLeakFinder.cpp
@@ -374,7 +374,8 @@ void memleakfinder_reportleaks_appendfile(const char *filename, const char *mark
}
else
{
- printf("WARNING: Couldn't open memory leak results file %s for appending\n", filename);
+ BOX_WARNING("Couldn't open memory leak results file " <<
+ filename << " for appending");
}
}
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;
}