diff options
author | Chris Wilson <chris+github@qwirx.com> | 2007-07-31 23:18:05 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2007-07-31 23:18:05 +0000 |
commit | 0b2fd98dd63c533e00c0d61ce022f37ee75857cc (patch) | |
tree | 5daa2a50b28b572e01281b622fee3adf818f5075 /lib/common | |
parent | 05db569d4efc62eaa10597142b8eac4937421e14 (diff) |
Replace almost all calls to syslog() with logging framework. (refs #3)
Diffstat (limited to 'lib/common')
-rw-r--r-- | lib/common/BoxTime.cpp | 9 | ||||
-rw-r--r-- | lib/common/DebugPrintf.cpp | 6 | ||||
-rw-r--r-- | lib/common/Logging.h | 14 |
3 files changed, 18 insertions, 11 deletions
diff --git a/lib/common/BoxTime.cpp b/lib/common/BoxTime.cpp index eafb244f..1ddcffd4 100644 --- a/lib/common/BoxTime.cpp +++ b/lib/common/BoxTime.cpp @@ -12,12 +12,11 @@ #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #endif + #ifdef HAVE_TIME_H #include <time.h> #endif -#ifdef HAVE_SYSLOG_H - #include <syslog.h> -#endif + #include <errno.h> #include <string.h> @@ -40,8 +39,8 @@ box_time_t GetCurrentBoxTime() struct timeval tv; if (gettimeofday(&tv, NULL) != 0) { - ::syslog(LOG_ERR, "gettimeofday() failed (%s), " - "dropping precision", strerror(errno)); + BOX_ERROR("Failed to gettimeofday(), dropping " + "precision: " << strerror(errno)); } else { diff --git a/lib/common/DebugPrintf.cpp b/lib/common/DebugPrintf.cpp index 8d75f458..14cd3534 100644 --- a/lib/common/DebugPrintf.cpp +++ b/lib/common/DebugPrintf.cpp @@ -14,12 +14,6 @@ #include <stdio.h> #include <stdarg.h> -#ifdef WIN32 - #include "emu.h" -#else - #include <syslog.h> -#endif - #include "MemLeakFindOn.h" // Use this apparently superflous printf function to avoid having to diff --git a/lib/common/Logging.h b/lib/common/Logging.h index aea488a5..e87d1d4f 100644 --- a/lib/common/Logging.h +++ b/lib/common/Logging.h @@ -10,6 +10,7 @@ #ifndef LOGGING__H #define LOGGING__H +#include <iomanip> #include <sstream> #include <vector> @@ -42,6 +43,19 @@ #define BOX_TRACE(stuff) BOX_LOG(Log::TRACE, stuff) #endif +#define BOX_FORMAT_ACCOUNT(accno) \ + std::hex << \ + std::showbase << \ + std::internal << \ + std::setw(8) << \ + std::setfill('0') << \ + (accno) + +#define BOX_FORMAT_OBJECTID(objectid) \ + std::hex << \ + std::showbase << \ + (objectid) + #undef ERROR namespace Log |