RDK Documentation (Open Sourced RDK Components)
logging.h
1 #ifndef LOGGING_H_
2 #define LOGGING_H_
3 
4 #include "rdk_debug.h"
5 
6 #define LOG_NMGR "LOG.RDK.NETSRVMGR"
7 
8 /**
9  * @brief NETSRVMGR_LOG_TYPE
10  * @{
11  */
12 #define LOG_ERR(fmt, ...) RDK_LOG(RDK_LOG_ERROR, LOG_NMGR, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
13 #define LOG_INFO(fmt, ...) RDK_LOG(RDK_LOG_INFO, LOG_NMGR, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
14 #define LOG_WARN(fmt, ...) RDK_LOG(RDK_LOG_WARN, LOG_NMGR, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
15 #define LOG_DBG(fmt, ...) RDK_LOG(RDK_LOG_DEBUG, LOG_NMGR, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
16 #define LOG_TRACE(fmt, ...) RDK_LOG(RDK_LOG_TRACE1, LOG_NMGR, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
17 #define LOG_FATAL(fmt, ...) RDK_LOG(RDK_LOG_FATAL, LOG_NMGR, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
18 
19 /** @} */ //END OF NET_LOG_TYPE
20 
21 class EntryExitLogger
22 {
23  const char* func;
24  const int line;
25 public:
26  EntryExitLogger (const char* func, const int line) : func (func), line (line)
27  {
28  RDK_LOG(RDK_LOG_TRACE1, LOG_NMGR, "[%s:%d] Entry\n", func, line);
29  }
30  ~EntryExitLogger ()
31  {
32  RDK_LOG(RDK_LOG_TRACE1, LOG_NMGR, "[%s:%d] Exit \n", func, line);
33  }
34 };
35 
36 #define LOG_ENTRY_EXIT EntryExitLogger entry_exit_logger (__FUNCTION__, __LINE__)
37 
38 #endif /* LOGGING_H_ */
EntryExitLogger
Definition: hostIf_utils.h:79
rdk_debug.h
RDK_LOG
#define RDK_LOG
Definition: rdk_debug.h:258