Go to the documentation of this file.
9 #ifndef NDN_LOGGING_HPP
10 #define NDN_LOGGING_HPP
12 #include "../common.hpp"
14 #ifdef NDN_CPP_HAVE_LOG4CXX
16 #include <log4cxx/logger.h>
18 #define MEMBER_LOGGER \
19 static log4cxx::LoggerPtr staticModuleLogger
21 #define INIT_MEMBER_LOGGER(className,name) \
22 log4cxx::LoggerPtr className::staticModuleLogger = log4cxx::Logger::getLogger(name)
24 #define INIT_LOGGER(name) \
25 static log4cxx::LoggerPtr staticModuleLogger = log4cxx::Logger::getLogger(name)
27 #define _LOG_DEBUG(x) \
28 LOG4CXX_DEBUG(staticModuleLogger, x)
30 #define _LOG_TRACE(x) \
31 LOG4CXX_TRACE(staticModuleLogger, x)
33 #define _LOG_FUNCTION(x) \
34 LOG4CXX_TRACE(staticModuleLogger, __FUNCTION__ << "(" << x << ")")
36 #define _LOG_FUNCTION_NOARGS \
37 LOG4CXX_TRACE(staticModuleLogger, __FUNCTION__ << "()")
39 #define _LOG_ERROR(x) \
40 LOG4CXX_ERROR(staticModuleLogger, x)
42 #define _LOG_ERROR_COND(cond,x) \
43 if (cond) { _LOG_ERROR(x) }
45 #define _LOG_DEBUG_COND(cond,x) \
46 if (cond) { _LOG_DEBUG(x) }
51 #else // else NDN_CPP_HAVE_LOG4CXX
53 #define INIT_LOGGER(name) struct LOGGING_DISABLED
54 #define _LOG_FUNCTION(x)
55 #define _LOG_FUNCTION_NOARGS
57 #define INIT_LOGGERS(x)
59 #define _LOG_ERROR_COND(cond,x)
60 #define _LOG_DEBUG_COND(cond,x)
63 #define INIT_MEMBER_LOGGER(className,name)
69 #define _LOG_DEBUG(x) \
70 { std::clog << s.substr(0, s.size() - 1) << " " << x << std::endl; }
76 #endif // NDN_CPP_HAVE_LOG4CXX