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