logger.hpp File Reference
#include "common.hpp"
#include <boost/log/common.hpp>
#include <boost/log/sources/logger.hpp>
#include "core/logger-factory.hpp"
+ Include dependency graph for logger.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  nfd::Logger
 provides logging for a module More...
 
struct  nfd::LoggerTimestamp
 a tag that writes a timestamp upon stream output More...
 

Namespaces

 nfd
 Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents, Colorado State University, University Pierre & Marie Curie, Sorbonne University, Washington University in St.
 

Macros

#define NFD_BOOST_LOG(x)   BOOST_LOG(x)
 
#define NFD_LOG(level, msg, expression)
 
#define NFD_LOG_DEBUG(expression)   NFD_LOG(DEBUG, DEBUG, expression)
 
#define NFD_LOG_ERROR(expression)   NFD_LOG(ERROR, ERROR, expression)
 
#define NFD_LOG_FATAL(expression)   NFD_LOG(FATAL, FATAL, expression)
 
#define NFD_LOG_INCLASS_2TEMPLATE_SPECIALIZATION_DEFINE(cls, s1, s2, name)
 
#define NFD_LOG_INCLASS_DECLARE()   static ::nfd::Logger& g_logger
 
#define NFD_LOG_INCLASS_DEFINE(cls, name)   ::nfd::Logger& cls::g_logger = ::nfd::LoggerFactory::create(name)
 
#define NFD_LOG_INCLASS_TEMPLATE_DEFINE(cls, name)
 
#define NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(cls, specialization, name)
 
#define NFD_LOG_INFO(expression)   NFD_LOG(INFO, INFO, expression)
 
#define NFD_LOG_INIT(name)   static ::nfd::Logger& g_logger = ::nfd::LoggerFactory::create(name)
 
#define NFD_LOG_LINE(msg, expression)   ::nfd::LoggerTimestamp{} << " "#msg": " << "[" << g_logger << "] " << expression
 
#define NFD_LOG_TRACE(expression)   NFD_LOG(TRACE, TRACE, expression)
 
#define NFD_LOG_WARN(expression)   NFD_LOG(WARN, WARNING, expression)
 

Enumerations

enum  nfd::LogLevel {
  nfd::LOG_FATAL = -1,
  nfd::LOG_NONE = 0,
  nfd::LOG_ERROR = 1,
  nfd::LOG_WARN = 2,
  nfd::LOG_INFO = 3,
  nfd::LOG_DEBUG = 4,
  nfd::LOG_TRACE = 5,
  nfd::LOG_ALL = 255
}
 indicates a log level More...
 

Functions

std::ostream & nfd::operator<< (std::ostream &os, const LoggerTimestamp &)
 write a timestamp to os More...
 
std::ostream & nfd::operator<< (std::ostream &output, const Logger &logger)
 

Macro Definition Documentation

#define NFD_BOOST_LOG (   x)    BOOST_LOG(x)

Definition at line 147 of file logger.hpp.

#define NFD_LOG (   level,
  msg,
  expression 
)
Value:
do { \
if (g_logger.isEnabled(::nfd::LOG_##level)) { \
NFD_BOOST_LOG(g_logger.boostLogger) << NFD_LOG_LINE(msg, expression); \
} \
} while (false)
#define NFD_BOOST_LOG(x)
Definition: logger.hpp:147
#define NFD_LOG_LINE(msg, expression)
Definition: logger.hpp:150

Definition at line 153 of file logger.hpp.

#define NFD_LOG_DEBUG (   expression)    NFD_LOG(DEBUG, DEBUG, expression)

Definition at line 161 of file logger.hpp.

#define NFD_LOG_ERROR (   expression)    NFD_LOG(ERROR, ERROR, expression)

Definition at line 164 of file logger.hpp.

#define NFD_LOG_FATAL (   expression)    NFD_LOG(FATAL, FATAL, expression)

Definition at line 165 of file logger.hpp.

#define NFD_LOG_INCLASS_2TEMPLATE_SPECIALIZATION_DEFINE (   cls,
  s1,
  s2,
  name 
)
Value:
template<> \
::nfd::Logger& cls<s1, s2>::g_logger = ::nfd::LoggerFactory::create(name)
static Logger & create(const std::string &moduleName)
provides logging for a module
Definition: logger.hpp:58

Definition at line 139 of file logger.hpp.

#define NFD_LOG_INCLASS_DECLARE ( )    static ::nfd::Logger& g_logger

Definition at line 125 of file logger.hpp.

#define NFD_LOG_INCLASS_DEFINE (   cls,
  name 
)    ::nfd::Logger& cls::g_logger = ::nfd::LoggerFactory::create(name)

Definition at line 128 of file logger.hpp.

#define NFD_LOG_INCLASS_TEMPLATE_DEFINE (   cls,
  name 
)
Value:
template<class T> \
static Logger & create(const std::string &moduleName)
provides logging for a module
Definition: logger.hpp:58

Definition at line 131 of file logger.hpp.

#define NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE (   cls,
  specialization,
  name 
)
Value:
template<> \
::nfd::Logger& cls<specialization>::g_logger = ::nfd::LoggerFactory::create(name)
static Logger & create(const std::string &moduleName)
provides logging for a module
Definition: logger.hpp:58

Definition at line 135 of file logger.hpp.

#define NFD_LOG_INFO (   expression)    NFD_LOG(INFO, INFO, expression)

Definition at line 162 of file logger.hpp.

#define NFD_LOG_INIT (   name)    static ::nfd::Logger& g_logger = ::nfd::LoggerFactory::create(name)

Definition at line 122 of file logger.hpp.

#define NFD_LOG_LINE (   msg,
  expression 
)    ::nfd::LoggerTimestamp{} << " "#msg": " << "[" << g_logger << "] " << expression

Definition at line 150 of file logger.hpp.

#define NFD_LOG_TRACE (   expression)    NFD_LOG(TRACE, TRACE, expression)

Definition at line 160 of file logger.hpp.

#define NFD_LOG_WARN (   expression)    NFD_LOG(WARN, WARNING, expression)

Definition at line 163 of file logger.hpp.