libbgp  0.6
A C++ BGP Library.
Public Member Functions | Protected Member Functions | List of all members
libbgp::BgpLogHandler Class Reference

The BgpLogHandler class. More...

#include <bgp-log-handler.h>

Public Member Functions

void log (LogLevel level, const char *format_str,...)
 Log a message. Consider using LIBBGP_LOG if logging the message needs a lot of computing power. (e.g., print Serializable or converting IP to string.) More...
 
void log (LogLevel level, const Serializable &serializable)
 Log a message. Consider using LIBBGP_LOG if logging the message needs a lot of computing power. (e.g., print Serializable or converting IP to string.) More...
 
void setLogLevel (LogLevel level)
 Set the log level. More...
 
LogLevel getLogLevel () const
 Get the log level. More...
 
virtual ~BgpLogHandler ()
 Destroy the Bgp Log Handler object.
 

Protected Member Functions

virtual void logImpl (const char *str)
 Log implementation. By default, it writes to stderr. You may implement your own BgpLogHandler to write message to a different place. More...
 

Detailed Description

The BgpLogHandler class.

The log handler class is used by various other classes to print message.

Examples:
deserialize-and-serialize.cc, peer-and-print.cc, route-event-bus.cc, route-filter.cc, and route-server.cc.

Definition at line 47 of file bgp-log-handler.h.

Member Function Documentation

◆ getLogLevel()

LogLevel libbgp::BgpLogHandler::getLogLevel ( ) const

Get the log level.

Returns
LogLevel log level.

Definition at line 43 of file bgp-log-handler.cc.

◆ log() [1/2]

void libbgp::BgpLogHandler::log ( LogLevel  level,
const char *  format_str,
  ... 
)

Log a message. Consider using LIBBGP_LOG if logging the message needs a lot of computing power. (e.g., print Serializable or converting IP to string.)

Parameters
levelLog level.
format_strprintf format string.
...printf variables.

Definition at line 56 of file bgp-log-handler.cc.

References logImpl().

Referenced by libbgp::BgpPathAttrib::BgpPathAttrib(), libbgp::BgpPathAttrib::clone(), libbgp::BgpPathAttribOrigin::clone(), libbgp::BgpPathAttribAsPath::clone(), libbgp::BgpPathAttribNexthop::clone(), libbgp::BgpPathAttribMed::clone(), libbgp::BgpPathAttribLocalPref::clone(), libbgp::BgpPathAttribAtomicAggregate::clone(), libbgp::BgpPathAttribAggregator::clone(), libbgp::BgpPathAttribAs4Path::clone(), libbgp::BgpPathAttribAs4Aggregator::clone(), libbgp::BgpPathAttribCommunity::clone(), libbgp::BgpPathAttribMpReachNlriIpv6::clone(), libbgp::BgpPathAttribMpReachNlriUnknow::clone(), libbgp::BgpPathAttribMpUnreachNlriIpv6::clone(), libbgp::BgpPathAttribMpUnreachNlriUnknow::clone(), libbgp::BgpSink::fill(), libbgp::Serializable::length(), libbgp::BgpPathAttribCommunity::length(), libbgp::BgpBadMessage::parse(), libbgp::BgpPacket::parse(), libbgp::BgpPathAttribMpReachNlriUnknow::parse(), libbgp::BgpSink::pour(), libbgp::Serializable::setError(), libbgp::BgpBadMessage::write(), libbgp::BgpPacket::write(), libbgp::BgpOpenMessage::write(), libbgp::BgpCapability4BytesAsn::write(), libbgp::BgpUpdateMessage::write(), libbgp::BgpPathAttrib::write(), libbgp::BgpCapabilityMpBgp::write(), libbgp::BgpCapabilityUnknow::write(), libbgp::BgpPathAttribOrigin::write(), libbgp::BgpPathAttribAsPath::write(), libbgp::BgpPathAttribNexthop::write(), libbgp::BgpPathAttribMed::write(), libbgp::BgpPathAttribLocalPref::write(), libbgp::BgpPathAttribAtomicAggregate::write(), libbgp::BgpPathAttribAggregator::write(), libbgp::BgpPathAttribAs4Path::write(), libbgp::BgpPathAttribAs4Aggregator::write(), libbgp::BgpPathAttribCommunity::write(), libbgp::BgpPathAttribMpReachNlriIpv6::write(), libbgp::BgpPathAttribMpReachNlriUnknow::write(), libbgp::BgpPathAttribMpUnreachNlriIpv6::write(), libbgp::BgpPathAttribMpUnreachNlriUnknow::write(), and libbgp::BgpPathAttrib::writeHeader().

◆ log() [2/2]

void libbgp::BgpLogHandler::log ( LogLevel  level,
const Serializable serializable 
)

Log a message. Consider using LIBBGP_LOG if logging the message needs a lot of computing power. (e.g., print Serializable or converting IP to string.)

Parameters
levelLog level.
serializableSerializable object to log.

Definition at line 78 of file bgp-log-handler.cc.

References logImpl(), and libbgp::Serializable::print().

◆ logImpl()

void libbgp::BgpLogHandler::logImpl ( const char *  str)
protectedvirtual

Log implementation. By default, it writes to stderr. You may implement your own BgpLogHandler to write message to a different place.

Parameters
strLog message.
Examples:
route-server.cc.

Definition at line 86 of file bgp-log-handler.cc.

Referenced by log(), and ~BgpLogHandler().

◆ setLogLevel()

void libbgp::BgpLogHandler::setLogLevel ( LogLevel  level)

Set the log level.

Parameters
levelLog level.
Examples:
peer-and-print.cc.

Definition at line 34 of file bgp-log-handler.cc.


The documentation for this class was generated from the following files: