-
Notifications
You must be signed in to change notification settings - Fork 391
/
ifmap_log.h
144 lines (119 loc) · 3.82 KB
/
ifmap_log.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
* Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
*/
#ifndef __IFMAP_LOG_H__
#define __IFMAP_LOG_H__
#include "sandesh/sandesh_types.h"
#include "sandesh/sandesh.h"
#include "sandesh/sandesh_trace.h"
#include "sandesh/common/vns_types.h"
#include "sandesh/common/vns_constants.h"
extern SandeshTraceBufferPtr IFMapTraceBuf;
extern SandeshTraceBufferPtr IFMapBigMsgTraceBuf;
extern SandeshTraceBufferPtr IFMapPeerTraceBuf;
extern SandeshTraceBufferPtr IFMapSmTraceBuf;
extern SandeshTraceBufferPtr IFMapXmppTraceBuf;
// Log and trace regular messages
#define IFMAP_DEBUG_LOG(obj, category, ...) \
do { \
if (!LoggingDisabled()) { \
obj::Send(g_vns_constants.CategoryNames.find(category)->second, \
SandeshLevel::SYS_DEBUG, __FILE__, __LINE__, ##__VA_ARGS__); \
} \
} while(0)
#define IFMAP_TRACE(obj, ...) \
do { \
if (!LoggingDisabled()) { \
obj::TraceMsg(IFMapTraceBuf, __FILE__, __LINE__, __VA_ARGS__); \
} \
} while(0)
#define IFMAP_DEBUG(obj, ...) \
do { \
IFMAP_DEBUG_LOG(obj, Category::IFMAP, __VA_ARGS__); \
IFMAP_TRACE(obj##Trace, __VA_ARGS__); \
} while(0)
#define IFMAP_DEBUG_ONLY(obj, ...) \
do { \
IFMAP_DEBUG_LOG(obj, Category::IFMAP, __VA_ARGS__); \
} while(0)
#define IFMAP_XMPP_TRACE(obj, ...) \
do { \
if (!LoggingDisabled()) { \
obj::TraceMsg(IFMapXmppTraceBuf, __FILE__, __LINE__, __VA_ARGS__); \
} \
} while(0)
#define IFMAP_XMPP_DEBUG(obj, ...) \
do { \
IFMAP_DEBUG_LOG(obj, Category::IFMAP_XMPP, __VA_ARGS__); \
IFMAP_XMPP_TRACE(obj##Trace, __VA_ARGS__); \
} while(0)
#define IFMAP_PEER_TRACE(obj, ...) \
do { \
if (!LoggingDisabled()) { \
obj::TraceMsg(IFMapPeerTraceBuf, __FILE__, __LINE__, __VA_ARGS__); \
} \
} while(0)
#define IFMAP_PEER_DEBUG(obj, ...) \
do { \
IFMAP_DEBUG_LOG(obj, Category::IFMAP_PEER, __VA_ARGS__); \
IFMAP_PEER_TRACE(obj##Trace, __VA_ARGS__); \
} while(0)
#define IFMAP_SM_TRACE(obj, ...) \
do { \
if (!LoggingDisabled()) { \
obj::TraceMsg(IFMapSmTraceBuf, __FILE__, __LINE__, __VA_ARGS__); \
} \
} while(0)
#define IFMAP_SM_DEBUG(obj, ...) \
do { \
IFMAP_DEBUG_LOG(obj, Category::IFMAP_STATE_MACHINE, __VA_ARGS__); \
IFMAP_SM_TRACE(obj##Trace, __VA_ARGS__); \
} while(0)
// Log and trace big-sized messages
#define IFMAP_DEBUG_LOG_BIG_MSG(obj, category, ...) \
do { \
if (!LoggingDisabled()) { \
obj::Send(g_vns_constants.CategoryNames.find(category)->second, \
SandeshLevel::SYS_DEBUG, __FILE__, __LINE__, ##__VA_ARGS__); \
} \
} while(0)
#define IFMAP_TRACE_BIG_MSG(obj, ...) \
do { \
if (!LoggingDisabled()) { \
obj::TraceMsg(IFMapBigMsgTraceBuf, __FILE__, __LINE__, __VA_ARGS__); \
} \
} while(0)
#define IFMAP_PEER_LOG_POLL_RESP(obj, ...) \
do { \
IFMAP_DEBUG_LOG_BIG_MSG(obj, Category::IFMAP_PEER, __VA_ARGS__); \
IFMAP_TRACE_BIG_MSG(obj##Trace, __VA_ARGS__); \
} while(0)
// Warnings
#define IFMAP_WARN_LOG(obj, category, ...) \
do { \
if (!LoggingDisabled()) { \
obj::Send(g_vns_constants.CategoryNames.find(category)->second, \
SandeshLevel::SYS_WARN, __FILE__, __LINE__, ##__VA_ARGS__); \
} \
} while(0)
#define IFMAP_WARN(obj, ...) \
do { \
IFMAP_WARN_LOG(obj, Category::IFMAP, __VA_ARGS__); \
IFMAP_TRACE(obj##Trace, __VA_ARGS__); \
} while(0)
#define IFMAP_XMPP_WARN(obj, ...) \
do { \
IFMAP_WARN_LOG(obj, Category::IFMAP_XMPP, __VA_ARGS__); \
IFMAP_XMPP_TRACE(obj##Trace, __VA_ARGS__); \
} while(0)
#define IFMAP_PEER_WARN(obj, ...) \
do { \
IFMAP_WARN_LOG(obj, Category::IFMAP_PEER, __VA_ARGS__); \
IFMAP_PEER_TRACE(obj##Trace, __VA_ARGS__); \
} while(0)
#define IFMAP_SM_WARN(obj, ...) \
do { \
IFMAP_WARN_LOG(obj, Category::IFMAP_STATE_MACHINE, __VA_ARGS__); \
IFMAP_SM_TRACE(obj##Trace, __VA_ARGS__); \
} while(0)
#endif // __IFMAP_LOG_H__