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.h27
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/common/Logging.h b/lib/common/Logging.h
index 35e14d83..24863d2c 100644
--- a/lib/common/Logging.h
+++ b/lib/common/Logging.h
@@ -18,17 +18,6 @@
#include "FileStream.h"
-/*
-#define BOX_LOG(level, stuff) \
-{ \
- if(Log::sMaxLoggingLevelForAnyOutput >= level) \
- std::ostringstream line; \
- line << stuff; \
- Log::Write(level, __FILE__, __LINE__, line.str()); \
- } \
-}
-*/
-
#define BOX_LOG(level, stuff) \
{ \
std::ostringstream _box_log_line; \
@@ -52,12 +41,20 @@
if (Logging::IsEnabled(Log::TRACE)) \
{ BOX_LOG(Log::TRACE, stuff) }
+#define BOX_SYS_ERROR(stuff) \
+ stuff << ": " << std::strerror(errno) << " (" << errno << ")"
+
#define BOX_LOG_SYS_WARNING(stuff) \
- BOX_WARNING(stuff << ": " << std::strerror(errno) << " (" << errno << ")")
+ BOX_WARNING(BOX_SYS_ERROR(stuff))
#define BOX_LOG_SYS_ERROR(stuff) \
- BOX_ERROR(stuff << ": " << std::strerror(errno) << " (" << errno << ")")
+ BOX_ERROR(BOX_SYS_ERROR(stuff))
#define BOX_LOG_SYS_FATAL(stuff) \
- BOX_FATAL(stuff << ": " << std::strerror(errno) << " (" << errno << ")")
+ BOX_FATAL(BOX_SYS_ERROR(stuff))
+
+#define LOG_AND_THROW_ERROR(message, filename, exception, subtype) \
+ BOX_LOG_SYS_ERROR(message << ": " << filename); \
+ THROW_EXCEPTION_MESSAGE(exception, subtype, \
+ BOX_SYS_ERROR(message << ": " << filename));
inline std::string GetNativeErrorMessage()
{
@@ -339,4 +336,6 @@ class HideExceptionMessageGuard
bool mOldHiddenState;
};
+std::string PrintEscapedBinaryData(const std::string& rInput);
+
#endif // LOGGING__H