OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ifmap_log.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef __IFMAP_LOG_H__
6 #define __IFMAP_LOG_H__
7 
8 #include "sandesh/sandesh_trace.h"
9 #include "sandesh/common/vns_types.h"
10 #include "sandesh/common/vns_constants.h"
11 
15 
16 // Log and trace regular messages
17 
18 #define IFMAP_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 IFMAP_TRACE(obj, ...) \
27 do { \
28  if (!LoggingDisabled()) { \
29  obj::TraceMsg(IFMapTraceBuf, __FILE__, __LINE__, __VA_ARGS__); \
30  } \
31 } while (false)
32 
33 #define IFMAP_DEBUG(obj, ...) \
34 do { \
35  IFMAP_DEBUG_LOG(obj, Category::IFMAP, __VA_ARGS__); \
36  IFMAP_TRACE(obj##Trace, __VA_ARGS__); \
37 } while (false)
38 
39 #define IFMAP_DEBUG_ONLY(obj, ...) \
40 do { \
41  IFMAP_DEBUG_LOG(obj, Category::IFMAP, __VA_ARGS__); \
42 } while (false)
43 
44 #define IFMAP_XMPP_TRACE(obj, ...) \
45 do { \
46  if (!LoggingDisabled()) { \
47  obj::TraceMsg(IFMapXmppTraceBuf, __FILE__, __LINE__, __VA_ARGS__); \
48  } \
49 } while (false)
50 
51 #define IFMAP_XMPP_DEBUG(obj, ...) \
52 do { \
53  IFMAP_DEBUG_LOG(obj, Category::IFMAP_XMPP, __VA_ARGS__); \
54  IFMAP_XMPP_TRACE(obj##Trace, __VA_ARGS__); \
55 } while (false)
56 
57 #define IFMAP_UPD_SENDER_TRACE(obj, ...) \
58 do { \
59  if (!LoggingDisabled()) { \
60  obj::TraceMsg(IFMapUpdateSenderBuf, __FILE__, __LINE__, __VA_ARGS__); \
61  } \
62 } while (false)
63 
64 #define IFMAP_WARN_LOG(obj, category, ...) \
65 do { \
66  if (!LoggingDisabled()) { \
67  obj::Send(g_vns_constants.CategoryNames.find(category)->second, \
68  SandeshLevel::SYS_WARN, __FILE__, __LINE__, ##__VA_ARGS__); \
69  } \
70 } while (false)
71 
72 #define IFMAP_WARN(obj, ...) \
73 do { \
74  IFMAP_WARN_LOG(obj, Category::IFMAP, __VA_ARGS__); \
75  IFMAP_TRACE(obj##Trace, __VA_ARGS__); \
76 } while (false)
77 
78 #define IFMAP_XMPP_WARN(obj, ...) \
79 do { \
80  IFMAP_WARN_LOG(obj, Category::IFMAP_XMPP, __VA_ARGS__); \
81  IFMAP_XMPP_TRACE(obj##Trace, __VA_ARGS__); \
82 } while (false)
83 
84 #endif // __IFMAP_LOG_H__
SandeshTraceBufferPtr IFMapUpdateSenderBuf
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
Definition: sandesh_trace.h:18
SandeshTraceBufferPtr IFMapTraceBuf
SandeshTraceBufferPtr IFMapXmppTraceBuf