OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bgp_log.h File Reference
#include "sandesh/sandesh_trace.h"
#include "sandesh/common/vns_types.h"
#include "base/logging.h"
#include "bgp/bgp_log_types.h"
#include "bgp/bgp_server.h"
#include "bgp/ipeer.h"
#include "bgp/bgp_table.h"
Include dependency graph for bgp_log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 bgp_log_test
 

Macros

#define BGP_DEBUG_UT(str)   BGP_LOG_STR(BgpMessage, Sandesh::LoggingUtLevel(), BGP_LOG_FLAG_ALL, str)
 
#define BGP_WARN_UT(str)   BGP_LOG_STR(BgpMessage, SandeshLevel::UT_WARN, BGP_LOG_FLAG_ALL, str)
 
#define BGP_TRACE_BUF   "BgpTraceBuf"
 
#define BGP_PEER_OBJECT_TRACE_BUF   "BgpPeerObjectTraceBuf"
 
#define BGP_LOG_FLAG_SYSLOG   1
 
#define BGP_LOG_FLAG_TRACE   2
 
#define BGP_LOG_FLAG_ALL   (BGP_LOG_FLAG_SYSLOG | BGP_LOG_FLAG_TRACE)
 
#define BGP_UVE_SEND(type, object)
 
#define BGP_UVE_SEND2(type, object, arg)
 
#define BGP_LOG(obj, level, flags,...)
 
#define BGP_LOG_NOTICE(obj, flags,...)
 
#define BGP_LOG_STR(obj, level, flags, arg)
 
#define BGP_LOG_ERROR_STR(obj, level, flags, arg)
 
#define BGP_LOG_WARNING_STR(obj, flags, arg)
 
#define BGP_LOG_NOTICE_STR(obj, flags, arg)
 
#define BGP_LOG_SERVER(peer, table)
 
#define BGP_PEER_DIR_OUT   "SEND"
 
#define BGP_PEER_DIR_IN   "RECV"
 
#define BGP_PEER_DIR_NA   ""
 
#define BGP_LOG_PEER_INTERNAL(type, peer, level, flags,...)
 
#define BGP_LOG_PEER(type, peer, level, flags, dir, arg)
 
#define BGP_LOG_PEER_NOTICE(type, peer, flags, dir, arg)
 
#define BGP_LOG_PEER_WARNING(type, peer, flags, dir, arg)
 
#define BGP_LOG_PEER_CRITICAL(type, peer, flags, dir, arg)
 
#define BGP_LOG_PEER_TABLE(peer, level, flags, tbl, arg)
 
#define BGP_LOG_PEER_INSTANCE(peer, instance, level, flags, arg)
 
#define BGP_LOG_PEER_INSTANCE_WARNING(peer, instance, flags, arg)
 
#define BGP_LOG_PEER_INSTANCE_CRITICAL(peer, instance, dir, flags, arg)
 
#define BGP_LOG_ROUTE(table, peer, route, arg)
 
#define BGP_LOG_TABLE(table, level, flags, arg)
 
#define BGP_CONFIG_LOG_INTERNAL(type, server, level, flags,...)
 
#define BGP_CONFIG_LOG_INSTANCE(type, server, rtinstance, level, flags,...)
 
#define BGP_CONFIG_LOG_NEIGHBOR(type, server, neighbor, level, flags,...)
 
#define BGP_CONFIG_LOG_PEERING(type, server, peering, level, flags,...)
 
#define BGP_CONFIG_LOG_PROTOCOL(type, server, protocol, level, flags,...)
 
#define BGP_TRACE_PEER_OBJECT(peer, peer_info)
 
#define BGP_TRACE_PEER_PACKET(peer, msg, size, level)
 

Functions

void bgp_log_test::init ()
 
void bgp_log_test::init (std::string log_file, unsigned long log_file_size, unsigned long log_file_index, bool enable_syslog, std::string syslog_facility, std::string ident, std::string log_level)
 
bool bgp_log_test::unit_test ()
 
void bgp_log_test::LogServerName (const BgpServer *server)
 
void bgp_log_test::LogServerName (const IPeer *ipeer, const BgpTable *table)
 

Variables

SandeshTraceBufferPtr BgpTraceBuf
 
SandeshTraceBufferPtr BgpPeerObjectTraceBuf
 

Macro Definition Documentation

#define BGP_CONFIG_LOG_INSTANCE (   type,
  server,
  rtinstance,
  level,
  flags,
  ... 
)
Value:
BGP_CONFIG_LOG_INTERNAL(Instance##type, server, level, flags, \
(rtinstance)->name(), ##__VA_ARGS__);
#define BGP_CONFIG_LOG_INTERNAL(type, server, level, flags,...)
Definition: bgp_log.h:270
uint8_t type
Definition: load_balance.h:109

Definition at line 284 of file bgp_log.h.

#define BGP_CONFIG_LOG_INTERNAL (   type,
  server,
  level,
  flags,
  ... 
)
Value:
do { \
if (LoggingDisabled()) break; \
if ((flags) & BGP_LOG_FLAG_SYSLOG) { \
BgpConfig##type##Log::Send("BGPConfig", level, \
__FILE__, __LINE__, ##__VA_ARGS__); \
} \
if ((flags) & BGP_LOG_FLAG_TRACE) { \
BgpConfig##type##Trace::TraceMsg(BgpTraceBuf, \
__FILE__, __LINE__, ##__VA_ARGS__); \
} \
} while (false)
SandeshTraceBufferPtr BgpTraceBuf
void LogServerName(const BgpServer *server)
Definition: bgp_log.cc:57
#define BGP_LOG_FLAG_SYSLOG
Definition: bgp_log.h:42
uint8_t type
Definition: load_balance.h:109
#define BGP_LOG_FLAG_TRACE
Definition: bgp_log.h:43
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 270 of file bgp_log.h.

#define BGP_CONFIG_LOG_NEIGHBOR (   type,
  server,
  neighbor,
  level,
  flags,
  ... 
)
Value:
BGP_CONFIG_LOG_INTERNAL(Neighbor##type, server, level, flags, \
(neighbor)->name(), ##__VA_ARGS__);
#define BGP_CONFIG_LOG_INTERNAL(type, server, level, flags,...)
Definition: bgp_log.h:270
uint8_t type
Definition: load_balance.h:109

Definition at line 288 of file bgp_log.h.

#define BGP_CONFIG_LOG_PEERING (   type,
  server,
  peering,
  level,
  flags,
  ... 
)
Value:
BGP_CONFIG_LOG_INTERNAL(Peering##type, server, level, flags, \
(peering)->name(), ##__VA_ARGS__);
#define BGP_CONFIG_LOG_INTERNAL(type, server, level, flags,...)
Definition: bgp_log.h:270
uint8_t type
Definition: load_balance.h:109

Definition at line 292 of file bgp_log.h.

#define BGP_CONFIG_LOG_PROTOCOL (   type,
  server,
  protocol,
  level,
  flags,
  ... 
)
Value:
BGP_CONFIG_LOG_INTERNAL(Protocol##type, server, level, flags, \
(protocol)->instance()->name(), ##__VA_ARGS__);
#define BGP_CONFIG_LOG_INTERNAL(type, server, level, flags,...)
Definition: bgp_log.h:270
uint8_t type
Definition: load_balance.h:109

Definition at line 296 of file bgp_log.h.

#define BGP_DEBUG_UT (   str)    BGP_LOG_STR(BgpMessage, Sandesh::LoggingUtLevel(), BGP_LOG_FLAG_ALL, str)

Definition at line 29 of file bgp_log.h.

#define BGP_LOG (   obj,
  level,
  flags,
  ... 
)
Value:
do { \
if (LoggingDisabled()) break; \
if ((flags) & BGP_LOG_FLAG_SYSLOG) { \
obj##Log::Send("BGP", level, __FILE__, __LINE__, ##__VA_ARGS__); \
if (bgp_log_test::unit_test()) break; \
} \
if ((flags) & BGP_LOG_FLAG_TRACE) { \
obj##Trace::TraceMsg(BgpTraceBuf, __FILE__, __LINE__, \
##__VA_ARGS__); \
} \
} while (false)
SandeshTraceBufferPtr BgpTraceBuf
#define BGP_LOG_FLAG_SYSLOG
Definition: bgp_log.h:42
bool unit_test()
Definition: bgp_log.cc:53
#define BGP_LOG_FLAG_TRACE
Definition: bgp_log.h:43
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 59 of file bgp_log.h.

#define BGP_LOG_ERROR_STR (   obj,
  level,
  flags,
  arg 
)
Value:
do { \
if (LoggingDisabled()) break; \
std::ostringstream _os; \
_os << arg; \
BGP_LOG(obj##Error, SandeshLevel::SYS_ERR, flags, _os.str()); \
} while (false)
#define BGP_LOG(obj, level, flags,...)
Definition: bgp_log.h:59
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 98 of file bgp_log.h.

#define BGP_LOG_FLAG_ALL   (BGP_LOG_FLAG_SYSLOG | BGP_LOG_FLAG_TRACE)

Definition at line 44 of file bgp_log.h.

#define BGP_LOG_FLAG_SYSLOG   1

Definition at line 42 of file bgp_log.h.

#define BGP_LOG_FLAG_TRACE   2

Definition at line 43 of file bgp_log.h.

#define BGP_LOG_NOTICE (   obj,
  flags,
  ... 
)
Value:
do { \
if (LoggingDisabled()) break; \
if ((flags) & BGP_LOG_FLAG_SYSLOG) { \
obj##Notice##Log::Send("BGP", SandeshLevel::SYS_NOTICE, __FILE__, \
__LINE__, ##__VA_ARGS__); \
if (bgp_log_test::unit_test()) break; \
} \
if ((flags) & BGP_LOG_FLAG_TRACE) { \
const std::string __trace_buf(BGP_TRACE_BUF); \
obj##Notice##Trace::TraceMsg(BgpTraceBuf, __FILE__, __LINE__, \
##__VA_ARGS__); \
} \
} while (false)
SandeshTraceBufferPtr BgpTraceBuf
#define BGP_LOG_FLAG_SYSLOG
Definition: bgp_log.h:42
bool unit_test()
Definition: bgp_log.cc:53
#define BGP_LOG_FLAG_TRACE
Definition: bgp_log.h:43
#define BGP_TRACE_BUF
Definition: bgp_log.h:36
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 73 of file bgp_log.h.

#define BGP_LOG_NOTICE_STR (   obj,
  flags,
  arg 
)
Value:
do { \
if (LoggingDisabled()) break; \
std::ostringstream _os; \
_os << arg; \
BGP_LOG(obj##Notice, SandeshLevel::SYS_NOTICE, flags, _os.str()); \
} while (false)
#define BGP_LOG(obj, level, flags,...)
Definition: bgp_log.h:59
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 116 of file bgp_log.h.

#define BGP_LOG_PEER (   type,
  peer,
  level,
  flags,
  dir,
  arg 
)
Value:
do { \
if (LoggingDisabled()) break; \
\
BGP_LOG_SERVER(peer, (BgpTable *) 0); \
std::ostringstream _os; \
_os << arg; \
BGP_LOG_PEER_INTERNAL(type, peer, level, flags, dir, _os.str()); \
} while (false)
uint8_t type
Definition: load_balance.h:109
#define BGP_LOG_SERVER(peer, table)
Definition: bgp_log.h:128
#define BGP_LOG_PEER_INTERNAL(type, peer, level, flags,...)
Definition: bgp_log.h:142
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 159 of file bgp_log.h.

#define BGP_LOG_PEER_CRITICAL (   type,
  peer,
  flags,
  dir,
  arg 
)
Value:
do { \
if (LoggingDisabled()) break; \
\
BGP_LOG_SERVER(peer, (BgpTable *) 0); \
std::ostringstream _os; \
_os << arg; \
BGP_LOG_PEER_INTERNAL(type##Critical, peer, SandeshLevel::SYS_CRIT, \
flags, dir, _os.str()); \
} while (false)
uint8_t type
Definition: load_balance.h:109
#define BGP_LOG_SERVER(peer, table)
Definition: bgp_log.h:128
#define BGP_LOG_PEER_INTERNAL(type, peer, level, flags,...)
Definition: bgp_log.h:142
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 194 of file bgp_log.h.

#define BGP_LOG_PEER_INSTANCE (   peer,
  instance,
  level,
  flags,
  arg 
)
Value:
do { \
if (LoggingDisabled()) break; \
std::ostringstream _os; \
_os << arg; \
BGP_LOG_PEER_INTERNAL(Instance, peer, level, flags, BGP_PEER_DIR_NA, \
instance, _os.str()); \
} while (false)
#define BGP_LOG_PEER_INTERNAL(type, peer, level, flags,...)
Definition: bgp_log.h:142
bool LoggingDisabled()
Definition: logging.cc:24
#define BGP_PEER_DIR_NA
Definition: bgp_log.h:140

Definition at line 218 of file bgp_log.h.

#define BGP_LOG_PEER_INSTANCE_CRITICAL (   peer,
  instance,
  dir,
  flags,
  arg 
)
Value:
do { \
if (LoggingDisabled()) break; \
std::ostringstream _os; \
_os << arg; \
BGP_LOG_PEER_INTERNAL(Instance, peer, SandeshLevel::SYS_CRIT, flags, \
dir, instance, _os.str()); \
} while (false)
#define BGP_LOG_PEER_INTERNAL(type, peer, level, flags,...)
Definition: bgp_log.h:142
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 237 of file bgp_log.h.

#define BGP_LOG_PEER_INSTANCE_WARNING (   peer,
  instance,
  flags,
  arg 
)
Value:
do { \
if (LoggingDisabled()) break; \
std::ostringstream _os; \
_os << arg; \
BGP_LOG_PEER_INTERNAL(Instance, peer, SandeshLevel::SYS_WARN, flags, \
instance, _os.str()); \
} while (false)
#define BGP_LOG_PEER_INTERNAL(type, peer, level, flags,...)
Definition: bgp_log.h:142
bool LoggingDisabled()
Definition: logging.cc:24
#define BGP_PEER_DIR_NA
Definition: bgp_log.h:140

Definition at line 227 of file bgp_log.h.

#define BGP_LOG_PEER_INTERNAL (   type,
  peer,
  level,
  flags,
  ... 
)
Value:
do { \
const IPeer *_peer = dynamic_cast<const IPeer *>(peer); \
std::string _peer_name; \
if (_peer) { \
_peer_name = _peer->ToUVEKey(); \
} else { \
_peer_name = "Unknown"; \
} \
if (_peer && _peer->IsXmppPeer()) { \
BGP_LOG(XmppPeer ## type, level, flags, _peer_name, ##__VA_ARGS__);\
} else { \
BGP_LOG(BgpPeer ## type, level, flags, _peer_name, ##__VA_ARGS__); \
} \
} while (false)
#define BGP_LOG(obj, level, flags,...)
Definition: bgp_log.h:59
Definition: ipeer.h:186
uint8_t type
Definition: load_balance.h:109
virtual const std::string & ToUVEKey() const =0

Definition at line 142 of file bgp_log.h.

#define BGP_LOG_PEER_NOTICE (   type,
  peer,
  flags,
  dir,
  arg 
)
Value:
do { \
if (LoggingDisabled()) break; \
\
BGP_LOG_SERVER(peer, (BgpTable *) 0); \
std::ostringstream _os; \
_os << arg; \
BGP_LOG_PEER_INTERNAL(type##Notice, peer, SandeshLevel::SYS_NOTICE, \
flags, dir, _os.str()); \
} while (false)
uint8_t type
Definition: load_balance.h:109
#define BGP_LOG_SERVER(peer, table)
Definition: bgp_log.h:128
#define BGP_LOG_PEER_INTERNAL(type, peer, level, flags,...)
Definition: bgp_log.h:142
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 170 of file bgp_log.h.

#define BGP_LOG_PEER_TABLE (   peer,
  level,
  flags,
  tbl,
  arg 
)
Value:
do { \
if (LoggingDisabled()) break; \
BGP_LOG_SERVER(peer, tbl); \
std::ostringstream _os; \
_os << arg; \
BGP_LOG_PEER_INTERNAL(Table, peer, level, flags, BGP_PEER_DIR_NA, \
(tbl) ? (tbl)->name() : "", \
((tbl) && (tbl)->routing_instance()) ? \
(tbl)->routing_instance()->name() : "", \
_os.str()); \
} while (false)
#define BGP_LOG_SERVER(peer, table)
Definition: bgp_log.h:128
#define BGP_LOG_PEER_INTERNAL(type, peer, level, flags,...)
Definition: bgp_log.h:142
bool LoggingDisabled()
Definition: logging.cc:24
#define BGP_PEER_DIR_NA
Definition: bgp_log.h:140

Definition at line 205 of file bgp_log.h.

#define BGP_LOG_PEER_WARNING (   type,
  peer,
  flags,
  dir,
  arg 
)
Value:
do { \
if (LoggingDisabled()) break; \
\
BGP_LOG_SERVER(peer, (BgpTable *) 0); \
std::ostringstream _os; \
_os << arg; \
BGP_LOG_PEER_INTERNAL(type##Warning, peer, SandeshLevel::SYS_WARN, \
flags, dir, _os.str()); \
} while (false)
uint8_t type
Definition: load_balance.h:109
#define BGP_LOG_SERVER(peer, table)
Definition: bgp_log.h:128
#define BGP_LOG_PEER_INTERNAL(type, peer, level, flags,...)
Definition: bgp_log.h:142
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 182 of file bgp_log.h.

#define BGP_LOG_ROUTE (   table,
  peer,
  route,
  arg 
)
Value:
do { \
if (LoggingDisabled()) break; \
BGP_LOG_SERVER(peer, table); \
std::ostringstream _os; \
_os << arg; \
BGP_LOG_PEER_INTERNAL(Route, peer, SandeshLevel::SYS_DEBUG, \
(route) ? (route)->ToString() : "", \
(table) ? (table)->name() : ""); \
} while (false)
Definition: route.h:14
static string ToString(PhysicalDevice::ManagementProtocol proto)
#define BGP_LOG_SERVER(peer, table)
Definition: bgp_log.h:128
#define BGP_LOG_FLAG_TRACE
Definition: bgp_log.h:43
#define BGP_LOG_PEER_INTERNAL(type, peer, level, flags,...)
Definition: bgp_log.h:142
bool LoggingDisabled()
Definition: logging.cc:24
#define BGP_PEER_DIR_NA
Definition: bgp_log.h:140

Definition at line 247 of file bgp_log.h.

#define BGP_LOG_SERVER (   peer,
  table 
)
Value:
if (LoggingDisabled()) break; \
if (dynamic_cast<const IPeer *>(peer) && \
dynamic_cast<const IPeer *>(peer)->server() && \
dynamic_cast<const IPeer *>(peer)->server()->logging_disabled()) \
break; \
bgp_log_test::LogServerName(dynamic_cast<const IPeer *>(peer), \
dynamic_cast<const BgpTable *>(table)); \
void LogServerName(const BgpServer *server)
Definition: bgp_log.cc:57
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 128 of file bgp_log.h.

#define BGP_LOG_STR (   obj,
  level,
  flags,
  arg 
)
Value:
do { \
if (LoggingDisabled()) break; \
std::ostringstream _os; \
_os << arg; \
BGP_LOG(obj, level, flags, _os.str()); \
} while (false)
#define BGP_LOG(obj, level, flags,...)
Definition: bgp_log.h:59
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 89 of file bgp_log.h.

#define BGP_LOG_TABLE (   table,
  level,
  flags,
  arg 
)
Value:
do { \
if (LoggingDisabled()) break; \
BGP_LOG_SERVER((const IPeer *) 0, table); \
std::ostringstream _os; \
_os << arg; \
BGP_LOG(BgpTable, level, flags, (table) ? (table)->name() : "", \
_os.str()); \
} while (false)
#define BGP_LOG(obj, level, flags,...)
Definition: bgp_log.h:59
Definition: ipeer.h:186
#define BGP_LOG_SERVER(peer, table)
Definition: bgp_log.h:128
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 260 of file bgp_log.h.

#define BGP_LOG_WARNING_STR (   obj,
  flags,
  arg 
)
Value:
do { \
if (LoggingDisabled()) break; \
std::ostringstream _os; \
_os << arg; \
BGP_LOG(obj##Warning, SandeshLevel::SYS_WARN, flags, _os.str()); \
} while (false)
#define BGP_LOG(obj, level, flags,...)
Definition: bgp_log.h:59
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 107 of file bgp_log.h.

#define BGP_PEER_DIR_IN   "RECV"

Definition at line 139 of file bgp_log.h.

#define BGP_PEER_DIR_NA   ""

Definition at line 140 of file bgp_log.h.

#define BGP_PEER_DIR_OUT   "SEND"

Definition at line 138 of file bgp_log.h.

#define BGP_PEER_OBJECT_TRACE_BUF   "BgpPeerObjectTraceBuf"

Definition at line 37 of file bgp_log.h.

#define BGP_TRACE_BUF   "BgpTraceBuf"

Definition at line 36 of file bgp_log.h.

#define BGP_TRACE_PEER_OBJECT (   peer,
  peer_info 
)
Value:
do { \
if (LoggingDisabled()) break; \
BGP_LOG_SERVER(peer, (BgpTable *) 0); \
BgpPeerObjectTrace::TraceMsg(BgpPeerObjectTraceBuf, __FILE__, __LINE__,\
peer_info); \
} while (false)
#define BGP_LOG_SERVER(peer, table)
Definition: bgp_log.h:128
SandeshTraceBufferPtr BgpPeerObjectTraceBuf
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 302 of file bgp_log.h.

#define BGP_TRACE_PEER_PACKET (   peer,
  msg,
  size,
  level 
)
Value:
do { \
if (LoggingDisabled()) break; \
if ((level) > Sandesh::LoggingLevel()) break; \
BgpPeerInfo peer_info; \
\
BGP_LOG_SERVER(peer, (BgpTable *) 0); \
(peer)->state_machine()->SetDataCollectionKey(&peer_info); \
peer_info.set_packet_data((peer)->BytesToHexString(msg, size)); \
BGP_TRACE_PEER_OBJECT(peer, peer_info); \
} while (false)
#define BGP_LOG_SERVER(peer, table)
Definition: bgp_log.h:128
#define BGP_TRACE_PEER_OBJECT(peer, peer_info)
Definition: bgp_log.h:302
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 310 of file bgp_log.h.

#define BGP_UVE_SEND (   type,
  object 
)
Value:
do { \
if (LoggingDisabled()) break; \
type::Send(object); \
} while (false) \
uint8_t type
Definition: load_balance.h:109
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 46 of file bgp_log.h.

#define BGP_UVE_SEND2 (   type,
  object,
  arg 
)
Value:
do { \
if (LoggingDisabled()) break; \
type::Send(object, arg); \
} while (false) \
uint8_t type
Definition: load_balance.h:109
bool LoggingDisabled()
Definition: logging.cc:24

Definition at line 52 of file bgp_log.h.

#define BGP_WARN_UT (   str)    BGP_LOG_STR(BgpMessage, SandeshLevel::UT_WARN, BGP_LOG_FLAG_ALL, str)

Definition at line 31 of file bgp_log.h.

Variable Documentation

SandeshTraceBufferPtr BgpPeerObjectTraceBuf
SandeshTraceBufferPtr BgpTraceBuf