summaryrefslogtreecommitdiff
path: root/lib/common/Logging.h
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2008-12-05 20:36:21 +0000
committerChris Wilson <chris+github@qwirx.com>2008-12-05 20:36:21 +0000
commitf7cff2e8357e8d63e36b21130fbe0da472f82007 (patch)
tree24b007ffbdb5332d2c9ba6011f1b73a6905e1f2a /lib/common/Logging.h
parentd0080cc1af9aa2fd6488ddb3f9f24e6c89239dc0 (diff)
Add BOX_LOG_NATIVE_ERROR and BOX_LOG_NATIVE_WARNING macros, which call
BOX_LOG_SYS_* or BOX_LOG_WIN_* depending on platform, as this is a common reason for #ifdefs elsewhere in the code. Add BOX_LOG_SOCKET_ERROR macro to log socket errors with the type, name and port of the socket that suffered the error.
Diffstat (limited to 'lib/common/Logging.h')
-rw-r--r--lib/common/Logging.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/common/Logging.h b/lib/common/Logging.h
index 0f4ba151..3d5ea370 100644
--- a/lib/common/Logging.h
+++ b/lib/common/Logging.h
@@ -67,8 +67,17 @@
BOX_ERROR(stuff << ": " << GetErrorMessage(number))
#define BOX_LOG_WIN_WARNING_NUMBER(stuff, number) \
BOX_WARNING(stuff << ": " << GetErrorMessage(number))
+ #define BOX_LOG_NATIVE_ERROR(stuff) BOX_LOG_WIN_ERROR(stuff)
+ #define BOX_LOG_NATIVE_WARNING(stuff) BOX_LOG_WIN_WARNING(stuff)
+#else
+ #define BOX_LOG_NATIVE_ERROR(stuff) BOX_LOG_SYS_ERROR(stuff)
+ #define BOX_LOG_NATIVE_WARNING(stuff) BOX_LOG_SYS_WARNING(stuff)
#endif
+#define BOX_LOG_SOCKET_ERROR(_type, _name, _port, stuff) \
+ BOX_LOG_NATIVE_ERROR(stuff << " (type " << _type << ", name " << \
+ _name << ", port " << _port << ")")
+
#define BOX_FORMAT_HEX32(number) \
std::hex << \
std::showbase << \