22 #ifndef NDN_UTIL_LOGGER_HPP    23 #define NDN_UTIL_LOGGER_HPP    27 #ifdef HAVE_NDN_CXX_CUSTOM_LOGGER    28 #include "ndn-cxx/util/custom-logger.hpp"    31 #include <boost/log/common.hpp>    32 #include <boost/log/expressions/keyword.hpp>    33 #include <boost/log/sources/severity_logger.hpp>    67 BOOST_LOG_ATTRIBUTE_KEYWORD(module, 
"Module", std::string)
    68 BOOST_LOG_ATTRIBUTE_KEYWORD(severity, 
"Severity", 
LogLevel)
    77 class Logger : 
public boost::log::sources::severity_logger_mt<LogLevel>
    84   registerModuleName(
const char* name);
    95     return m_currentLevel.load(std::memory_order_relaxed) >= level;
   101     m_currentLevel.store(level, std::memory_order_relaxed);
   105   const std::string m_moduleName;
   106   std::atomic<LogLevel> m_currentLevel;
   113 struct ExtractArgument;
   115 template<
class T, 
class U>
   116 struct ExtractArgument<T(U&)>
   121 template<
class T, 
class U>
   122 struct ExtractArgument<T(U)&>
   128 using ArgumentType = 
typename ExtractArgument<T>::type;
   135 #define NDN_LOG_REGISTER_NAME(name) \   137     ::ndn::util::Logger::registerModuleName(BOOST_STRINGIZE(name)); \   142 #define NDN_LOG_INIT_FUNCTION_BODY(name) \   144     static ::ndn::util::Logger logger(BOOST_STRINGIZE(name)); \   163 #define NDN_LOG_INIT(name) \   165     const bool ndn_cxx_loggerRegistration __attribute__((used)) = NDN_LOG_REGISTER_NAME(name); \   166     ::ndn::util::Logger& ndn_cxx_getLogger() \   167     NDN_LOG_INIT_FUNCTION_BODY(name) \   169   struct ndn_cxx_allow_trailing_semicolon   181 #define NDN_LOG_MEMBER_DECL() \   182   static ::ndn::util::Logger& ndn_cxx_getLogger(); \   184   static const bool ndn_cxx_loggerRegistration   198 #define NDN_LOG_MEMBER_INIT(cls, name) \   199   const bool ::ndn::util::detail::ArgumentType<void(cls&)>::ndn_cxx_loggerRegistration = \   200   NDN_LOG_REGISTER_NAME(name); \   201   ::ndn::util::Logger& ::ndn::util::detail::ArgumentType<void(cls&)>::ndn_cxx_getLogger() \   202   NDN_LOG_INIT_FUNCTION_BODY(name) \   203   struct ndn_cxx_allow_trailing_semicolon   209 #define NDN_LOG_MEMBER_DECL_SPECIALIZED(cls) \   211   const bool ::ndn::util::detail::ArgumentType<void(cls&)>::ndn_cxx_loggerRegistration; \   213   ::ndn::util::Logger& ::ndn::util::detail::ArgumentType<void(cls&)>::ndn_cxx_getLogger()   226 #define NDN_LOG_MEMBER_INIT_SPECIALIZED(cls, name) \   228   const bool ::ndn::util::detail::ArgumentType<void(cls&)>::ndn_cxx_loggerRegistration = \   229   NDN_LOG_REGISTER_NAME(name); \   231   ::ndn::util::Logger& ::ndn::util::detail::ArgumentType<void(cls&)>::ndn_cxx_getLogger() \   232   NDN_LOG_INIT_FUNCTION_BODY(name) \   233   struct ndn_cxx_allow_trailing_semicolon   236 #if BOOST_VERSION == 105900   238 #define NDN_BOOST_LOG(x, sev) BOOST_LOG_SEV(x, sev) << ""   240 #define NDN_BOOST_LOG(x, sev) BOOST_LOG_SEV(x, sev)   244 #define NDN_LOG_INTERNAL(lvl, expression) \   246     if (ndn_cxx_getLogger().isLevelEnabled(::ndn::util::LogLevel::lvl)) { \   247       NDN_BOOST_LOG(ndn_cxx_getLogger(), ::ndn::util::LogLevel::lvl)  \   257 #define NDN_LOG_TRACE(expression) NDN_LOG_INTERNAL(TRACE, expression)   262 #define NDN_LOG_DEBUG(expression) NDN_LOG_INTERNAL(DEBUG, expression)   267 #define NDN_LOG_INFO(expression) NDN_LOG_INTERNAL(INFO, expression)   272 #define NDN_LOG_WARN(expression) NDN_LOG_INTERNAL(WARN, expression)   277 #define NDN_LOG_ERROR(expression) NDN_LOG_INTERNAL(ERROR, expression)   282 #define NDN_LOG_FATAL(expression) NDN_LOG_INTERNAL(FATAL, expression)   287 #endif // HAVE_NDN_CXX_CUSTOM_LOGGER   289 #endif // NDN_UTIL_LOGGER_HPP 
trace messages (most verbose) 
std::ostream & operator<<(std::ostream &os, LogLevel level)
Output LogLevel as a string. 
bool isLevelEnabled(LogLevel level) const
LogLevel
Indicates the severity level of a log message. 
Common includes and macros used throughout the library. 
LogLevel parseLogLevel(const std::string &s)
Parse LogLevel from a string. 
const std::string & getModuleName() const
Represents a log module in the logging facility. 
fatal (will be logged unconditionally) 
void setLevel(LogLevel level)