Skip to content

Commit

Permalink
Merge "Create separate trace buffers for each module" into R2.21.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed May 21, 2016
2 parents 47a93a2 + 1ce3d21 commit 9c5a4d1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 6 deletions.
11 changes: 11 additions & 0 deletions src/ifmap/ifmap_log.cc
Expand Up @@ -12,3 +12,14 @@ SandeshTraceBufferPtr IFMapTraceBuf(SandeshTraceBufferCreate("IFMapTraceBuf",
SandeshTraceBufferPtr IFMapBigMsgTraceBuf(
SandeshTraceBufferCreate("IFMapBigMsgTraceBuf", 25));

// Trace buffer for peer messages
SandeshTraceBufferPtr IFMapPeerTraceBuf(
SandeshTraceBufferCreate("IFMapPeerTraceBuf", 50000));

// Trace buffer for state-machine messages
SandeshTraceBufferPtr IFMapSmTraceBuf(
SandeshTraceBufferCreate("IFMapSmTraceBuf", 50000));

// Trace buffer for xmpp messages
SandeshTraceBufferPtr IFMapXmppTraceBuf(
SandeshTraceBufferCreate("IFMapXmppTraceBuf", 50000));
36 changes: 30 additions & 6 deletions src/ifmap/ifmap_log.h
Expand Up @@ -13,6 +13,9 @@

extern SandeshTraceBufferPtr IFMapTraceBuf;
extern SandeshTraceBufferPtr IFMapBigMsgTraceBuf;
extern SandeshTraceBufferPtr IFMapPeerTraceBuf;
extern SandeshTraceBufferPtr IFMapSmTraceBuf;
extern SandeshTraceBufferPtr IFMapXmppTraceBuf;

// Log and trace regular messages

Expand Down Expand Up @@ -42,22 +45,43 @@ 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_TRACE(obj##Trace, __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_TRACE(obj##Trace, __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_TRACE(obj##Trace, __VA_ARGS__); \
IFMAP_SM_TRACE(obj##Trace, __VA_ARGS__); \
} while(0)

// Log and trace big-sized messages
Expand Down Expand Up @@ -102,19 +126,19 @@ do { \
#define IFMAP_XMPP_WARN(obj, ...) \
do { \
IFMAP_WARN_LOG(obj, Category::IFMAP_XMPP, __VA_ARGS__); \
IFMAP_TRACE(obj##Trace, __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_TRACE(obj##Trace, __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_TRACE(obj##Trace, __VA_ARGS__); \
IFMAP_SM_TRACE(obj##Trace, __VA_ARGS__); \
} while(0)

#endif // __IFMAP_LOG_H__

0 comments on commit 9c5a4d1

Please sign in to comment.