logger.hpp File Reference
#include "../common.hpp"
#include <boost/log/common.hpp>
#include <boost/log/sources/logger.hpp>
#include <atomic>
+ 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  ndn::util::Logger
 represents a logger in logging facility More...
 
struct  ndn::util::LoggerTimestamp
 a tag that writes a timestamp upon stream output More...
 

Namespaces

 ndn
 Copyright (c) 2013-2017 Regents of the University of California.
 
 ndn::util
 

Macros

#define NDN_BOOST_LOG(x)   BOOST_LOG(x)
 
#define NDN_LOG(lvl, lvlstr, expression)
 
#define NDN_LOG_DEBUG(expression)   NDN_LOG(DEBUG, DEBUG, expression)
 log at DEBUG level More...
 
#define NDN_LOG_ERROR(expression)   NDN_LOG(ERROR, ERROR, expression)
 log at ERROR level More...
 
#define NDN_LOG_FATAL(expression)   NDN_LOG(FATAL, FATAL, expression)
 log at FATAL level More...
 
#define NDN_LOG_INFO(expression)   NDN_LOG(INFO, INFO, expression)
 log at INFO level More...
 
#define NDN_LOG_INIT(name)
 declare a log module More...
 
#define NDN_LOG_TRACE(expression)   NDN_LOG(TRACE, TRACE, expression)
 log at TRACE level More...
 
#define NDN_LOG_WARN(expression)   NDN_LOG(WARN, WARNING, expression)
 log at WARN level More...
 

Enumerations

enum  ndn::util::LogLevel {
  ndn::util::LogLevel::FATAL = -1,
  ndn::util::LogLevel::NONE = 0,
  ndn::util::LogLevel::ERROR = 1,
  ndn::util::LogLevel::WARN = 2,
  ndn::util::LogLevel::INFO = 3,
  ndn::util::LogLevel::DEBUG = 4,
  ndn::util::LogLevel::TRACE = 5,
  ndn::util::LogLevel::ALL = 255
}
 indicates the severity level of a log message More...
 

Functions

std::ostream & ndn::util::operator<< (std::ostream &os, LogLevel level)
 output LogLevel as string More...
 
std::ostream & ndn::util::operator<< (std::ostream &os, const LoggerTimestamp &)
 write a timestamp to os More...
 
LogLevel ndn::util::parseLogLevel (const std::string &s)
 parse LogLevel from string More...
 

Macro Definition Documentation

#define NDN_BOOST_LOG (   x)    BOOST_LOG(x)

Definition at line 130 of file logger.hpp.

#define NDN_LOG (   lvl,
  lvlstr,
  expression 
)
Value:
do { \
if (getNdnCxxLogger().isLevelEnabled(::ndn::util::LogLevel::lvl)) { \
<< " " BOOST_STRINGIZE(lvlstr) ": [" << getNdnCxxLogger().getModuleName() << "] " \
<< expression; \
} \
} while (false)
a tag that writes a timestamp upon stream output
Definition: logger.hpp:116
#define NDN_BOOST_LOG(x)
Definition: logger.hpp:130

Definition at line 133 of file logger.hpp.

#define NDN_LOG_DEBUG (   expression)    NDN_LOG(DEBUG, DEBUG, expression)

log at DEBUG level

Precondition
A log module must be declared in the same translation unit.

Definition at line 150 of file logger.hpp.

#define NDN_LOG_ERROR (   expression)    NDN_LOG(ERROR, ERROR, expression)

log at ERROR level

Precondition
A log module must be declared in the same translation unit.

Definition at line 165 of file logger.hpp.

#define NDN_LOG_FATAL (   expression)    NDN_LOG(FATAL, FATAL, expression)

log at FATAL level

Precondition
A log module must be declared in the same translation unit.

Definition at line 170 of file logger.hpp.

#define NDN_LOG_INFO (   expression)    NDN_LOG(INFO, INFO, expression)

log at INFO level

Precondition
A log module must be declared in the same translation unit.

Definition at line 155 of file logger.hpp.

#define NDN_LOG_INIT (   name)
Value:
namespace { \
inline ::ndn::util::Logger& getNdnCxxLogger() \
{ \
static ::ndn::util::Logger logger(BOOST_STRINGIZE(name)); \
return logger; \
} \
} \
struct ndn_cxx__allow_trailing_semicolon

declare a log module

Note
Logger name is restricted to alphanumeric characters and a select set of symbols: ~, #, %, _, <, >, ., - A logger name must not start or end with . or contain consecutive .

Definition at line 101 of file logger.hpp.

#define NDN_LOG_TRACE (   expression)    NDN_LOG(TRACE, TRACE, expression)

log at TRACE level

Precondition
A log module must be declared in the same translation unit.

Definition at line 145 of file logger.hpp.

#define NDN_LOG_WARN (   expression)    NDN_LOG(WARN, WARNING, expression)

log at WARN level

Precondition
A log module must be declared in the same translation unit.

Definition at line 160 of file logger.hpp.