summaryrefslogtreecommitdiff
path: root/lib/common/Logging.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common/Logging.h')
-rw-r--r--lib/common/Logging.h33
1 files changed, 25 insertions, 8 deletions
diff --git a/lib/common/Logging.h b/lib/common/Logging.h
index 2d726627..2c967c89 100644
--- a/lib/common/Logging.h
+++ b/lib/common/Logging.h
@@ -27,16 +27,16 @@
#define BOX_LOG(level, stuff) \
{ \
- std::ostringstream line; \
- line << stuff; \
- Logging::Log(level, __FILE__, __LINE__, line.str()); \
+ std::ostringstream _box_log_line; \
+ _box_log_line << stuff; \
+ Logging::Log(level, __FILE__, __LINE__, _box_log_line.str()); \
}
#define BOX_SYSLOG(level, stuff) \
{ \
- std::ostringstream line; \
- line << stuff; \
- Logging::LogToSyslog(level, __FILE__, __LINE__, line.str()); \
+ std::ostringstream _box_log_line; \
+ _box_log_line << stuff; \
+ Logging::LogToSyslog(level, __FILE__, __LINE__, _box_log_line.str()); \
}
#define BOX_FATAL(stuff) BOX_LOG(Log::FATAL, stuff)
@@ -48,15 +48,32 @@
if (Logging::IsEnabled(Log::TRACE)) \
{ BOX_LOG(Log::TRACE, stuff) }
-#define BOX_FORMAT_ACCOUNT(accno) \
+#define BOX_LOG_SYS_WARNING(stuff) \
+ BOX_WARNING(stuff << ": " << strerror(errno) << " (" << errno << ")")
+#define BOX_LOG_SYS_ERROR(stuff) \
+ BOX_ERROR(stuff << ": " << strerror(errno) << " (" << errno << ")")
+#define BOX_LOG_SYS_FATAL(stuff) \
+ BOX_FATAL(stuff << ": " << strerror(errno) << " (" << errno << ")")
+
+#ifdef WIN32
+ #define BOX_LOG_WIN_ERROR(stuff) \
+ BOX_ERROR(stuff << ": " << GetErrorMessage(GetLastError()))
+ #define BOX_LOG_WIN_ERROR_NUMBER(stuff, number) \
+ BOX_ERROR(stuff << ": " << GetErrorMessage(number))
+#endif
+
+#define BOX_FORMAT_HEX32(number) \
std::hex << \
std::showbase << \
std::internal << \
std::setw(10) << \
std::setfill('0') << \
- (accno) << \
+ (number) << \
std::dec
+#define BOX_FORMAT_ACCOUNT(accno) \
+ BOX_FORMAT_HEX32(accno)
+
#define BOX_FORMAT_OBJECTID(objectid) \
std::hex << \
std::showbase << \