From f7cff2e8357e8d63e36b21130fbe0da472f82007 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 5 Dec 2008 20:36:21 +0000 Subject: 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. --- lib/common/Logging.h | 9 +++++++++ 1 file changed, 9 insertions(+) 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 << \ -- cgit v1.2.3