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.h74
1 files changed, 0 insertions, 74 deletions
diff --git a/lib/common/Logging.h b/lib/common/Logging.h
index bc0203bb..1074b7c3 100644
--- a/lib/common/Logging.h
+++ b/lib/common/Logging.h
@@ -10,11 +10,8 @@
#ifndef LOGGING__H
#define LOGGING__H
-<<<<<<< HEAD
-=======
#include <assert.h>
->>>>>>> 0.12
#include <cerrno>
#include <cstring>
#include <iomanip>
@@ -46,33 +43,6 @@
if (Logging::IsEnabled(Log::TRACE)) \
{ BOX_LOG(Log::TRACE, stuff) }
-<<<<<<< HEAD
-#define BOX_SYS_ERROR(stuff) \
- stuff << ": " << std::strerror(errno) << " (" << errno << ")"
-
-#define BOX_LOG_SYS_WARNING(stuff) \
- BOX_WARNING(BOX_SYS_ERROR(stuff))
-#define BOX_LOG_SYS_ERROR(stuff) \
- BOX_ERROR(BOX_SYS_ERROR(stuff))
-#define BOX_LOG_SYS_FATAL(stuff) \
- 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()
-{
-#ifdef WIN32
- return GetErrorMessage(GetLastError());
-#else
- std::ostringstream _box_log_line;
- _box_log_line << std::strerror(errno) << " (" << errno << ")";
- return _box_log_line.str();
-#endif
-}
-=======
#define BOX_SYS_ERRNO_MESSAGE(error_number, stuff) \
stuff << ": " << std::strerror(error_number) << \
" (" << error_number << ")"
@@ -113,7 +83,6 @@ inline std::string GetNativeErrorMessage()
#define THROW_FILE_ERROR(message, filename, exception, subtype) \
THROW_EXCEPTION_MESSAGE(exception, subtype, \
BOX_FILE_MESSAGE(filename, message))
->>>>>>> 0.12
#ifdef WIN32
#define BOX_LOG_WIN_ERROR(stuff) \
@@ -126,8 +95,6 @@ inline std::string GetNativeErrorMessage()
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)
-<<<<<<< HEAD
-=======
#define BOX_WIN_ERRNO_MESSAGE(error_number, stuff) \
stuff << ": " << GetErrorMessage(error_number)
#define THROW_WIN_ERROR_NUMBER(message, error_number, exception, subtype) \
@@ -139,17 +106,11 @@ inline std::string GetNativeErrorMessage()
#define THROW_WIN_FILE_ERROR(message, filename, exception, subtype) \
THROW_WIN_FILE_ERRNO(message, filename, GetLastError(), \
exception, subtype)
->>>>>>> 0.12
#else
#define BOX_LOG_NATIVE_ERROR(stuff) BOX_LOG_SYS_ERROR(stuff)
#define BOX_LOG_NATIVE_WARNING(stuff) BOX_LOG_SYS_WARNING(stuff)
#endif
-<<<<<<< HEAD
-#define BOX_LOG_SOCKET_ERROR(_type, _name, _port, stuff) \
- BOX_LOG_NATIVE_ERROR(stuff << " (type " << _type << ", name " << \
- _name << ", port " << _port << ")")
-=======
#ifdef WIN32
# define BOX_LOG_SOCKET_ERROR(_type, _name, _port, stuff) \
BOX_LOG_WIN_ERROR_NUMBER(stuff << " (type " << _type << ", name " << \
@@ -159,7 +120,6 @@ inline std::string GetNativeErrorMessage()
BOX_LOG_NATIVE_ERROR(stuff << " (type " << _type << ", name " << \
_name << ", port " << _port << ")")
#endif
->>>>>>> 0.12
#define BOX_FORMAT_HEX32(number) \
std::hex << \
@@ -184,15 +144,12 @@ inline std::string GetNativeErrorMessage()
std::setw(6) << \
timespec.tv_usec
-<<<<<<< HEAD
-=======
#define BOX_FORMAT_MICROSECONDS(t) \
(int)((t) / 1000000) << "." << \
std::setw(6) << \
std::setfill('0') << \
(int)((t) % 1000000) << " seconds"
->>>>>>> 0.12
#undef ERROR
namespace Log
@@ -240,10 +197,6 @@ class Logger
virtual const char* GetType() = 0;
Log::Level GetLevel() { return mCurrentLevel; }
-<<<<<<< HEAD
-
- virtual void SetProgramName(const std::string& rProgramName) = 0;
-=======
bool IsEnabled(Log::Level level);
virtual void SetProgramName(const std::string& rProgramName) = 0;
@@ -265,7 +218,6 @@ class Logger
mLogger.Filter(mOldLevel);
}
};
->>>>>>> 0.12
};
// --------------------------------------------------------------------------
@@ -373,42 +325,29 @@ class Logging
static void SetProgramName(const std::string& rProgramName);
static std::string GetProgramName() { return sProgramName; }
static void SetFacility(int facility);
-<<<<<<< HEAD
-=======
static Console& GetConsole() { return *spConsole; }
static Syslog& GetSyslog() { return *spSyslog; }
->>>>>>> 0.12
class Guard
{
private:
Log::Level mOldLevel;
-<<<<<<< HEAD
-=======
static int sGuardCount;
static Log::Level sOriginalLevel;
->>>>>>> 0.12
public:
Guard(Log::Level newLevel)
{
mOldLevel = Logging::GetGlobalLevel();
-<<<<<<< HEAD
-=======
if(sGuardCount == 0)
{
sOriginalLevel = mOldLevel;
}
sGuardCount++;
->>>>>>> 0.12
Logging::SetGlobalLevel(newLevel);
}
~Guard()
{
-<<<<<<< HEAD
- Logging::SetGlobalLevel(mOldLevel);
- }
-=======
sGuardCount--;
Logging::SetGlobalLevel(mOldLevel);
}
@@ -420,7 +359,6 @@ class Logging
return IsActive() &&
(int)sOriginalLevel >= (int)originalLevel;
}
->>>>>>> 0.12
};
class Tagger
@@ -429,11 +367,6 @@ class Logging
std::string mOldTag;
public:
-<<<<<<< HEAD
- Tagger(const std::string& rTempTag)
- {
- mOldTag = Logging::GetProgramName();
-=======
Tagger()
: mOldTag(Logging::GetProgramName())
{
@@ -441,21 +374,17 @@ class Logging
Tagger(const std::string& rTempTag)
: mOldTag(Logging::GetProgramName())
{
->>>>>>> 0.12
Logging::SetProgramName(mOldTag + " " + rTempTag);
}
~Tagger()
{
Logging::SetProgramName(mOldTag);
}
-<<<<<<< HEAD
-=======
void Change(const std::string& newTempTag)
{
Logging::SetProgramName(mOldTag + " " + newTempTag);
}
->>>>>>> 0.12
};
};
@@ -498,8 +427,6 @@ class HideExceptionMessageGuard
bool mOldHiddenState;
};
-<<<<<<< HEAD
-=======
class HideSpecificExceptionGuard
{
private:
@@ -524,7 +451,6 @@ class HideSpecificExceptionGuard
static bool IsHidden(int type, int subtype);
};
->>>>>>> 0.12
std::string PrintEscapedBinaryData(const std::string& rInput);
#endif // LOGGING__H