IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Namespaces | Functions
BaseLog.h File Reference

Base Logger for IPSDK library. More...

#include <log4cplus/logger.h>
#include <log4cplus/loglevel.h>
#include <log4cplus/loggingmacros.h>
#include <string>
#include <IPSDKUtil/IPSDKUtilExports.h>
#include <IPSDKUtil/Logger/LogUtils.h>
#include <IPSDKUtil/Logger/LogMessageFormater.h>
#include <IPSDKUtil/Logger/BaseException.h>
#include <IPSDKUtil/Logger/UnHandleException.h>
#include <boost/preprocessor/seq.hpp>
#include <boost/current_function.hpp>

Go to the source code of this file.

Namespaces

 ipsdk
 Main namespace for IPSDK library.
 

Macros

Logs

Macros enabling loggin management for library.

#define IPSDK_LOG(libraryName, msg, level)
 Logging of message msg to logger associated to library libraryName with level log level. More...
 
#define IPSDK_LOG_TRACE(libraryName, msg)   IPSDK_LOG(libraryName, msg, TRACE_LOG_LEVEL);
 Logging of message msg to logger associated to library libraryName trace log level.
 
#define IPSDK_LOG_DEBUG(libraryName, msg)   IPSDK_LOG(libraryName, msg, DEBUG_LOG_LEVEL);
 Logging of message msg to logger associated to library libraryName debug log level.
 
#define IPSDK_LOG_INFO(libraryName, msg)   IPSDK_LOG(libraryName, msg, INFO_LOG_LEVEL);
 Logging of message msg to logger associated to library libraryName info log level.
 
#define IPSDK_LOG_WARN(libraryName, msg)   IPSDK_LOG(libraryName, msg, WARN_LOG_LEVEL);
 Logging of message msg to logger associated to library libraryName warn log level.
 
#define IPSDK_LOG_ERROR(libraryName, msg)   IPSDK_LOG(libraryName, msg, ERROR_LOG_LEVEL);
 Logging of message msg to logger associated to library libraryName error log level.
 
Exceptions

Macros enabling exception management for library [!output REAL_PROJECT_NAME].

#define IPSDK_THROW(libraryName, msg)
 Unconditional exception thrown of an exception logging of msg value to logger associated to library libraryName. More...
 
#define IPSDK_RETHROW(libraryName, msg, previousExcp)
 Unconditional exception rethrown of exception previousExcp to an exception logging of msg value to logger associated to library libraryName. More...
 
#define IPSDK_CHECK(libraryName, bPredicate, msg)
 Unconditional exception thrown of an exception logging of msg value to logger associated to library libraryName. More...
 

Functions

IPSDKUTIL_API const std::string & ipsdk::getBaseLoggerName ()
 Recovery of main logger name associated to library.
 
IPSDKUTIL_API log4cplus::Logger & ipsdk::getBaseLogger ()
 Recovery of main logger associated to library.
 

Detailed Description

Base Logger for IPSDK library.

Author
E. Noirfalise
Date
2013/2/15

Macro Definition Documentation

◆ IPSDK_LOG

#define IPSDK_LOG (   libraryName,
  msg,
  level 
)
Value:
do { \
try { \
log4cplus::Logger usedLogger = (IPSDK_LIB_LOGGER(libraryName)); \
if(usedLogger.isEnabledFor(log4cplus::level) == true) { \
ipsdk::LogMessageFormater msgInternal(IPSDK_LIB_LOG_MSG_MANAGER(libraryName)); \
msgInternal msg; \
ipsdk::logMessage(usedLogger, log4cplus::level, msgInternal.string(), \
__FILE__, __LINE__); \
} \
} \
catch (const ipsdk::BaseException& e) { \
std::string errMsg("Exception thrown while processing message"); \
LOG4CPLUS_ERROR(ipsdk::getBaseLogger(), errMsg); \
throw ipsdk::BaseException(errMsg, BOOST_CURRENT_FUNCTION, \
__FILE__, __LINE__, e); \
} \
catch (const std::exception& e) { \
std::string errMsg("Exception thrown while processing message"); \
LOG4CPLUS_ERROR(ipsdk::getBaseLogger(), errMsg); \
throw ipsdk::BaseException(errMsg, BOOST_CURRENT_FUNCTION, \
__FILE__, __LINE__, e); \
} \
catch (...) { \
std::string errMsg("Exception thrown while processing message"); \
LOG4CPLUS_ERROR(ipsdk::getBaseLogger(), errMsg); \
throw ipsdk::BaseException(errMsg, BOOST_CURRENT_FUNCTION, \
__FILE__, __LINE__, ipsdk::UnHandleException()); \
} \
} while (0);
IPSDKUTIL_API log4cplus::Logger & getBaseLogger()
Recovery of main logger associated to library.
Base exception class for IPSDK library.
Definition: BaseException.h:36
Class used for rethrow of unhandled exception.
Definition: UnHandleException.h:26
#define IPSDK_LIB_LOGGER(libraryName)
macro allowing to retrieve a library logger getter function given its base name
Definition: BaseMacros.h:54
#define IPSDK_LIB_LOG_MSG_MANAGER(libraryName)
macro allowing to retrieve a library log message manager getter function given its base name ...
Definition: BaseMacros.h:61
IPSDKUTIL_API void logMessage(log4cplus::Logger &logger, const log4cplus::LogLevel &logLevel, const std::string &message, const std::string &fileName, const ipInt32 lineNumber)
function allowing to log a message

Logging of message msg to logger associated to library libraryName with level log level.

◆ IPSDK_THROW

#define IPSDK_THROW (   libraryName,
  msg 
)
Value:
do { \
ipsdk::LogMessageFormater msgInternalThrow(IPSDK_LIB_LOG_MSG_MANAGER(libraryName)); \
try { \
msgInternalThrow msg; \
} \
catch (const ipsdk::BaseException& e) { \
std::string errMsg("Exception thrown while processing message"); \
LOG4CPLUS_ERROR(ipsdk::getBaseLogger(), errMsg); \
throw ipsdk::BaseException(errMsg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, e); \
} \
catch (const std::exception& e) { \
std::string errMsg("Exception thrown while processing message"); \
LOG4CPLUS_ERROR(ipsdk::getBaseLogger(), errMsg); \
throw ipsdk::BaseException(errMsg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, e); \
} \
catch (...) { \
std::string errMsg("Exception thrown while processing message"); \
LOG4CPLUS_ERROR(ipsdk::getBaseLogger(), errMsg); \
throw ipsdk::BaseException(errMsg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \
} \
IPSDK_LOG_ERROR(libraryName, << msgInternalThrow.string()); \
throw IPSDK_LIB_EXCEPTION(libraryName)(msgInternalThrow.string(), \
BOOST_CURRENT_FUNCTION, __FILE__, __LINE__); \
} while(0);
IPSDKUTIL_API log4cplus::Logger & getBaseLogger()
Recovery of main logger associated to library.
Base exception class for IPSDK library.
Definition: BaseException.h:36
Class used for rethrow of unhandled exception.
Definition: UnHandleException.h:26
#define IPSDK_LIB_LOG_MSG_MANAGER(libraryName)
macro allowing to retrieve a library log message manager getter function given its base name ...
Definition: BaseMacros.h:61
#define IPSDK_LIB_EXCEPTION(libraryName)
macro allowing to retrieve a library exception class given its base name
Definition: BaseMacros.h:40

Unconditional exception thrown of an exception logging of msg value to logger associated to library libraryName.

Check of predicate bPredicate with exception thrown with logging of msg value to logger associated to library libraryName in case of failure.

◆ IPSDK_RETHROW

#define IPSDK_RETHROW (   libraryName,
  msg,
  previousExcp 
)
Value:
do { \
ipsdk::LogMessageFormater msgInternalReThrow(IPSDK_LIB_LOG_MSG_MANAGER(libraryName)); \
try { \
msgInternalReThrow msg; \
} \
catch (const ipsdk::BaseException& e) { \
std::string errMsg("Exception thrown while processing message"); \
LOG4CPLUS_ERROR(ipsdk::getBaseLogger(), errMsg); \
throw ipsdk::BaseException(errMsg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, e); \
} \
catch (const std::exception& e) { \
std::string errMsg("Exception thrown while processing message"); \
LOG4CPLUS_ERROR(ipsdk::getBaseLogger(), errMsg); \
throw ipsdk::BaseException(errMsg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, e); \
} \
catch (...) { \
std::string errMsg("Exception thrown while processing message"); \
LOG4CPLUS_ERROR(ipsdk::getBaseLogger(), errMsg); \
throw ipsdk::BaseException(errMsg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \
} \
IPSDK_LOG_ERROR(libraryName, << msgInternalReThrow.string()); \
throw IPSDK_LIB_EXCEPTION(libraryName)(msgInternalReThrow.string(), \
BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \
previousExcp); \
} while(0);
IPSDKUTIL_API log4cplus::Logger & getBaseLogger()
Recovery of main logger associated to library.
Base exception class for IPSDK library.
Definition: BaseException.h:36
Class used for rethrow of unhandled exception.
Definition: UnHandleException.h:26
#define IPSDK_LIB_LOG_MSG_MANAGER(libraryName)
macro allowing to retrieve a library log message manager getter function given its base name ...
Definition: BaseMacros.h:61
#define IPSDK_LIB_EXCEPTION(libraryName)
macro allowing to retrieve a library exception class given its base name
Definition: BaseMacros.h:40

Unconditional exception rethrown of exception previousExcp to an exception logging of msg value to logger associated to library libraryName.

◆ IPSDK_CHECK

#define IPSDK_CHECK (   libraryName,
  bPredicate,
  msg 
)
Value:
do { \
if (!(bPredicate)) { \
ipsdk::LogMessageFormater msgInternalCheck(IPSDK_LIB_LOG_MSG_MANAGER(libraryName)); \
try { \
msgInternalCheck msg; \
} \
catch (const ipsdk::BaseException& e) { \
std::string errMsg("Exception thrown while processing message"); \
LOG4CPLUS_ERROR(ipsdk::getBaseLogger(), errMsg); \
throw ipsdk::BaseException(errMsg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, e); \
} \
catch (const std::exception& e) { \
std::string errMsg("Exception thrown while processing message"); \
LOG4CPLUS_ERROR(ipsdk::getBaseLogger(), errMsg); \
throw ipsdk::BaseException(errMsg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, e); \
} \
catch (...) { \
std::string errMsg("Exception thrown while processing message"); \
LOG4CPLUS_ERROR(ipsdk::getBaseLogger(), errMsg); \
throw ipsdk::BaseException(errMsg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \
} \
IPSDK_LOG_ERROR(libraryName, << msgInternalCheck.string()); \
throw IPSDK_LIB_EXCEPTION(libraryName)(msgInternalCheck.string(), \
BOOST_CURRENT_FUNCTION, __FILE__, __LINE__); \
} \
} while(0);
IPSDKUTIL_API log4cplus::Logger & getBaseLogger()
Recovery of main logger associated to library.
Base exception class for IPSDK library.
Definition: BaseException.h:36
Class used for rethrow of unhandled exception.
Definition: UnHandleException.h:26
#define IPSDK_LIB_LOG_MSG_MANAGER(libraryName)
macro allowing to retrieve a library log message manager getter function given its base name ...
Definition: BaseMacros.h:61
#define IPSDK_LIB_EXCEPTION(libraryName)
macro allowing to retrieve a library exception class given its base name
Definition: BaseMacros.h:40

Unconditional exception thrown of an exception logging of msg value to logger associated to library libraryName.

Check of predicate bPredicate with exception thrown with logging of msg value to logger associated to library libraryName in case of failure.