Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
libLogger

C++ library for handling logging. More...

Classes

class  logger::LogBackend
 Abstract class for logger backends. More...
 

Macros

#define LOGS(MSG)
 Automatically create LoggerScope object which logs at the construction and destruction. More...
 
#define LOG(SEVERITY, MESSAGE)
 Generic logging macro. More...
 
#define LOGE(MESSAGE)   LOG(ERROR, MESSAGE)
 Logging errors. More...
 
#define LOGW(MESSAGE)   LOG(WARN, MESSAGE)
 Logging warnings. More...
 
#define LOGI(MESSAGE)   LOG(INFO, MESSAGE)
 Logging information. More...
 
#define LOGD(MESSAGE)   LOG(DEBUG, MESSAGE)
 Logging debug information. More...
 
#define LOGH(MESSAGE)   LOG(HELP, MESSAGE)
 Logging helper information (for debugging purposes) More...
 
#define LOGT(MESSAGE)   LOG(TRACE, MESSAGE)
 Logging tracing information. More...
 

Enumerations

enum  logger::LogLevel : int {
  logger::LogLevel::TRACE, logger::LogLevel::DEBUG, logger::LogLevel::INFO, logger::LogLevel::WARN,
  logger::LogLevel::ERROR, logger::LogLevel::HELP
}
 Available log levels. More...
 

Detailed Description

C++ library for handling logging.

There are few backends implemented and it's possible to create your own by inheriting after the logger::LogBackend interface.

Example usage:

using namespace logger;
// Set minimal logging level
// Set one of the possible backends:
Logger::setLogBackend(new FileBackend("/tmp/logs.txt"));
// All logs should be visible:
LOGE("Error");
LOGW("Warning");
LOGI("Information");
LOGD("Debug");
LOGT("Trace");
LOGH("Helper");
{
LOGS("Scope");
}

Macro Definition Documentation

#define LOG (   SEVERITY,
  MESSAGE 
)
Value:
do { \
if (logger::Logger::getLogLevel() <= logger::LogLevel::SEVERITY) { \
std::ostringstream messageStream__; \
messageStream__ << MESSAGE; \
logger::Logger::logMessage(logger::LogLevel::SEVERITY, \
messageStream__.str(), \
__FILE__, \
__LINE__, \
__func__, \
} \
} while (0)
static LogLevel getLogLevel(void)
Definition: logger.cpp:103
static void logMessage(LogLevel logLevel, const std::string &message, const std::string &file, const unsigned int line, const std::string &func, const std::string &rootDir)
Definition: logger.cpp:81
#define PROJECT_SOURCE_DIR
Definition: logger.hpp:77

Generic logging macro.

#define LOGD (   MESSAGE)    LOG(DEBUG, MESSAGE)

Logging debug information.

#define LOGE (   MESSAGE)    LOG(ERROR, MESSAGE)

Logging errors.

#define LOGH (   MESSAGE)    LOG(HELP, MESSAGE)

Logging helper information (for debugging purposes)

#define LOGI (   MESSAGE)    LOG(INFO, MESSAGE)

Logging information.

#define LOGS (   MSG)
Value:
logger::LoggerScope logScopeObj(__FILE__, __LINE__, __func__, \
Class specifically for scope debug logging.
Definition: logger-scope.hpp:53
#define PROJECT_SOURCE_DIR
Definition: logger.hpp:77
Definition: logger-scope.hpp:33

Automatically create LoggerScope object which logs at the construction and destruction.

#define LOGT (   MESSAGE)    LOG(TRACE, MESSAGE)

Logging tracing information.

#define LOGW (   MESSAGE)    LOG(WARN, MESSAGE)

Logging warnings.

Enumeration Type Documentation

enum logger::LogLevel : int
strong

Available log levels.

Enumerator
TRACE 

Most detailed log level.

DEBUG 

Debug logs.

INFO 

Information.

WARN 

Warnings.

ERROR 

Errors.

HELP 

Helper logs.