17 const char* bgp_log_level_str[] = {
25 BgpLogHandler::BgpLogHandler() {
57 if (level > this->level)
return;
60 int pre_sz = snprintf(out_buffer, 4096,
"[%s] ", bgp_log_level_str[level]);
63 va_start(args, format_str);
64 vsnprintf(out_buffer + pre_sz, 4096 - pre_sz, format_str, args);
80 int pre_sz = snprintf(out_buffer, 4096,
"[%s] ", bgp_log_level_str[level]);
81 serializable.
print((uint8_t *) (out_buffer + pre_sz), 4096 - pre_sz);
87 fprintf(::stderr,
"%s", str);
LogLevel
Log levels for logger (BgpLogHandler)
The serializable base class.
ssize_t print(uint8_t *to, size_t buf_sz) const
Print the Serializable object as human readable string.
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...
virtual void logImpl(const char *str)
Log implementation. By default, it writes to stderr. You may implement your own BgpLogHandler to writ...
void setLogLevel(LogLevel level)
Set the log level.
LogLevel getLogLevel() const
Get the log level.