OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
xmpp_log.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef __XMPP_LOG_H__
6 #define __XMPP_LOG_H__
7 
8 #include "base/logging.h"
9 #include "sandesh/sandesh_trace.h"
10 
11 #define XMPP_MESSAGE_TRACE_BUF "XmppMessageTrace"
12 #define XMPP_TRACE_BUF "XmppTrace"
13 
14 #define XMPP_PEER_DIR_OUT "SEND"
15 #define XMPP_PEER_DIR_IN "RECV"
16 #define XMPP_PEER_DIR_NA ""
17 
18 #define XMPP_ERROR(obj, ...) \
19 do { \
20  if (LoggingDisabled()) break; \
21  obj::Send(g_vns_constants.CategoryNames.find(Category::XMPP)->second, \
22  SandeshLevel::SYS_ERR, __FILE__, __LINE__, ##__VA_ARGS__); \
23 } while (false)
26 
27 #define XMPP_ALERT(obj, ...) \
28 do { \
29  if (LoggingDisabled()) break; \
30  obj::Send(g_vns_constants.CategoryNames.find(Category::XMPP)->second, \
31  SandeshLevel::SYS_ALERT, __FILE__, __LINE__, ##__VA_ARGS__); \
32  XMPP_TRACE(obj##Trace, ##__VA_ARGS__); \
33 } while (false)
34 
35 #define XMPP_WARNING(obj, ...) \
36 do { \
37  if (LoggingDisabled()) break; \
38  obj::Send(g_vns_constants.CategoryNames.find(Category::XMPP)->second, \
39  SandeshLevel::SYS_WARN, __FILE__, __LINE__, ##__VA_ARGS__); \
40  XMPP_TRACE(obj##Trace, ##__VA_ARGS__); \
41 } while (false)
42 
43 #define XMPP_NOTICE(obj, ...) \
44 do { \
45  if (LoggingDisabled()) break; \
46  obj::Send(g_vns_constants.CategoryNames.find(Category::XMPP)->second, \
47  SandeshLevel::SYS_NOTICE, __FILE__, __LINE__, ##__VA_ARGS__); \
48  XMPP_TRACE(obj##Trace, ##__VA_ARGS__); \
49 } while (false)
50 
51 #define XMPP_INFO(obj, ...) \
52 do { \
53  if (LoggingDisabled()) break; \
54  obj::Send(g_vns_constants.CategoryNames.find(Category::XMPP)->second, \
55  SandeshLevel::SYS_INFO, __FILE__, __LINE__, ##__VA_ARGS__); \
56  XMPP_TRACE(obj##Trace, ##__VA_ARGS__); \
57 } while (false)
58 
59 #define XMPP_DEBUG(obj, ...) \
60 do { \
61  if (LoggingDisabled()) break; \
62  obj::Send(g_vns_constants.CategoryNames.find(Category::XMPP)->second, \
63  SandeshLevel::SYS_DEBUG, __FILE__, __LINE__, ##__VA_ARGS__); \
64  XMPP_TRACE(obj##Trace, ##__VA_ARGS__); \
65 } while (false)
66 
67 #define XMPP_UTDEBUG(obj, ...) \
68 do { \
69  if (LoggingDisabled()) break; \
70  obj::Send(g_vns_constants.CategoryNames.find(Category::XMPP)->second, \
71  Sandesh::LoggingUtLevel(), __FILE__, __LINE__, ##__VA_ARGS__); \
72 } while (false)
73 
74 #define XMPP_TRACE(obj, ...) do { \
75  obj::TraceMsg(XmppTraceBuf, __FILE__, __LINE__, ##__VA_ARGS__); \
76 } while (false)
77 
78 #define XMPP_MESSAGE_TRACE(obj, ...) do { \
79  if (LoggingDisabled()) break; \
80  obj::TraceMsg(XmppMessageTraceBuf, __FILE__, __LINE__, ##__VA_ARGS__); \
81 } while (false)
82 
83 #define XMPP_CONNECTION_LOG_MSG(info) \
84 do { \
85  if (LoggingDisabled()) break; \
86  XMPP_CONNECTION_LOG_SEND(info); \
87 } while (false)
88 
89 #endif // __XMPP_LOG_H__
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
Definition: sandesh_trace.h:18
SandeshTraceBufferPtr XmppMessageTraceBuf
SandeshTraceBufferPtr XmppTraceBuf