OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
eql_log.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef __EQL_LOG_H__
6 #define __EQL_LOG_H__
7 
8 #include "sandesh/sandesh_trace.h"
9 #include "sandesh/common/vns_types.h"
10 #include "sandesh/common/vns_constants.h"
11 
12 #define EQL_TRACE_BUF "EtcdClientTraceBuf"
14 
15 // Log and trace regular messages
16 
17 #define EQL_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 EQL_DEBUG(obj, arg) \
26 do { \
27  if (LoggingDisabled()) break; \
28  std::ostringstream _os; \
29  _os << arg; \
30  EQL_DEBUG_LOG(obj, Category::EQL, _os.str()); \
31  EQL_TRACE(obj##Trace, _os.str()); \
32 } while (false)
33 
34 
35 #define EQL_TRACE(obj, ...) \
36 do { \
37  if (!LoggingDisabled()) { \
38  obj::TraceMsg(EqlTraceBuf, __FILE__, __LINE__, __VA_ARGS__); \
39  } \
40 } while (false)
41 
42 #define EQL_DEBUG_ONLY(obj, ...) \
43 do { \
44  EQL_DEBUG_LOG(obj, Category::EQL, __VA_ARGS__); \
45 } while (false)
46 
47 // Warnings
48 
49 #define EQL_WARN_LOG(obj, category, ...) \
50 do { \
51  if (!LoggingDisabled()) { \
52  obj::Send(g_vns_constants.CategoryNames.find(category)->second, \
53  SandeshLevel::SYS_WARN, __FILE__, __LINE__, ##__VA_ARGS__); \
54  } \
55 } while (false)
56 
57 #define EQL_WARN(obj, ...) \
58 do { \
59  EQL_WARN_LOG(obj, Category::EQL, __VA_ARGS__); \
60  EQL_TRACE(obj##Trace, __VA_ARGS__); \
61 } while (false)
62 
63 #endif // __EQL_LOG_H__
SandeshTraceBufferPtr EqlTraceBuf
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
Definition: sandesh_trace.h:18