OpenSDN source code
config_client_log.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  * Copyright Contributors to the OpenSDN project
4  */
5 
6 #ifndef __CONFIG_CLIENT_LOG_H__
7 #define __CONFIG_CLIENT_LOG_H__
8 
9 #include "sandesh/sandesh_trace.h"
10 #include "sandesh/common/vns_types.h"
11 #include "sandesh/common/vns_constants.h"
12 
15 
16 // Log and trace regular messages
17 
18 #define CONFIG_CLIENT_DEBUG_LOG(obj, category, ...) \
19 do { \
20  if (!LoggingDisabled()) { \
21  obj::Send(g_vns_constants.CategoryNames.find(category)->second, \
22  SandeshLevel::SYS_DEBUG, __FILE__, __LINE__, ##__VA_ARGS__); \
23  } \
24 } while (false)
25 
26 #define CONFIG_CLIENT_DEBUG(obj, ...) \
27 do { \
28  CONFIG_CLIENT_DEBUG_LOG(obj, Category::CONFIG_CLIENT, __VA_ARGS__); \
29  CONFIG_CLIENT_TRACE(obj##Trace, __VA_ARGS__); \
30 } while (false)
31 
32 
33 #define CONFIG_CLIENT_TRACE(obj, ...) \
34 do { \
35  if (!LoggingDisabled()) { \
36  obj::TraceMsg(ConfigClientTraceBuf, __FILE__, __LINE__, __VA_ARGS__); \
37  } \
38 } while (false)
39 
40 #define CONFIG_CLIENT_DEBUG_ONLY(obj, ...) \
41 do { \
42  CONFIG_CLIENT_DEBUG_LOG(obj, Category::CONFIG_CLIENT, __VA_ARGS__); \
43 } while (false)
44 
45 #define CONFIG_CLIENT_RABBIT_MSG_TRACE(obj, ...) \
46 do { \
47  if (!LoggingDisabled()) { \
48  obj::TraceMsg(ConfigClientRabbitMsgTraceBuf, __FILE__, __LINE__, \
49  __VA_ARGS__); \
50  } \
51 } while (false)
52 
53 // Warnings
54 
55 #define CONFIG_CLIENT_WARN_LOG(obj, category, ...) \
56 do { \
57  if (!LoggingDisabled()) { \
58  obj::Send(g_vns_constants.CategoryNames.find(category)->second, \
59  SandeshLevel::SYS_WARN, __FILE__, __LINE__, ##__VA_ARGS__); \
60  } \
61 } while (false)
62 
63 #define CONFIG_CLIENT_WARN(obj, ...) \
64 do { \
65  CONFIG_CLIENT_WARN_LOG(obj, Category::CONFIG_CLIENT, __VA_ARGS__); \
66  CONFIG_CLIENT_TRACE(obj##Trace, __VA_ARGS__); \
67 } while (false)
68 
69 #endif // __CONFIG_CLIENT_LOG_H__
SandeshTraceBufferPtr ConfigClientRabbitMsgTraceBuf
SandeshTraceBufferPtr ConfigClientTraceBuf
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
Definition: sandesh_trace.h:19