Fawkes API  Fawkes Development Version
fawkes::LibLogger Class Reference

Library logger. More...

#include <>>

Static Public Member Functions

static void init (MultiLogger *multi_logger=NULL)
 Initialize logger. More...
 
static void finalize ()
 Delete internal logger. More...
 
static void add_logger (Logger *logger)
 Add logger. More...
 
static void remove_logger (Logger *logger)
 Remove logger. More...
 
static void log_debug (const char *component, const char *format,...)
 Log debug message. More...
 
static void log_info (const char *component, const char *format,...)
 Log informational message. More...
 
static void log_warn (const char *component, const char *format,...)
 Log warning message. More...
 
static void log_error (const char *component, const char *format,...)
 Log error message. More...
 
static void vlog_debug (const char *component, const char *format, va_list va)
 Log debug message. More...
 
static void vlog_info (const char *component, const char *format, va_list va)
 Log informational message. More...
 
static void vlog_warn (const char *component, const char *format, va_list va)
 Log warning message. More...
 
static void vlog_error (const char *component, const char *format, va_list va)
 Log error message. More...
 
static void log_debug (const char *component, Exception &e)
 Log debug message. More...
 
static void log_info (const char *component, Exception &e)
 Log informational message. More...
 
static void log_warn (const char *component, Exception &e)
 Log warning message. More...
 
static void log_error (const char *component, Exception &e)
 Log error message. More...
 

Detailed Description

Library logger.

This logger is meant to be used in libraries that depend on utils anyway and in utils itself. This logger is completely static so it only has to be initialized once per process. If the logger is used before it has been initialized it is automatically initialized with an empty MultiLogger. If you want to see output you have to make sure that you add loggers like the ConsoleLogger.

Make sure that you call finalize() at the end of the surrounding process to free all the loggers associcated with the internal multi logger and the multi logger itself.

See also
MultiLogger
Author
Tim Niemueller

Definition at line 38 of file liblogger.h.

Member Function Documentation

◆ add_logger()

void fawkes::LibLogger::add_logger ( Logger l)
static

Add logger.

Parameters
lsub-logger to add
See also
MultiLogger::add_logger()

Definition at line 97 of file liblogger.cpp.

References fawkes::MultiLogger::add_logger(), init(), fawkes::Mutex::lock(), and fawkes::Mutex::unlock().

◆ finalize()

void fawkes::LibLogger::finalize ( )
static

Delete internal logger.

Note that the multi logger took over ownership of the loggers.

See also
MultiLogger

Definition at line 83 of file liblogger.cpp.

◆ init()

void fawkes::LibLogger::init ( MultiLogger multi_logger = NULL)
static

Initialize logger.

Parameters
multi_loggerLogger to use in this multi logger. If NULL a new logger is created. Note that LibLogger takes over ownership of the multi logger and will destroy it if finalize() is called.

Definition at line 63 of file liblogger.cpp.

Referenced by add_logger(), log_debug(), log_error(), log_info(), log_warn(), remove_logger(), vlog_debug(), vlog_error(), vlog_info(), and vlog_warn().

◆ log_debug() [1/2]

void fawkes::LibLogger::log_debug ( const char *  component,
const char *  format,
  ... 
)
static

Log debug message.

Parameters
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.

Definition at line 126 of file liblogger.cpp.

References init(), fawkes::Mutex::lock(), fawkes::Mutex::unlock(), and fawkes::MultiLogger::vlog_debug().

Referenced by fawkes::BlackBoardNetworkHandler::client_disconnected(), and fawkes::BlackBoardNetworkHandler::loop().

◆ log_debug() [2/2]

void fawkes::LibLogger::log_debug ( const char *  component,
Exception e 
)
static

Log debug message.

Parameters
componentcomponent, used to distuinguish logged messages
eexception to log, exception messages will be logged

Definition at line 262 of file liblogger.cpp.

References init(), fawkes::Mutex::lock(), fawkes::MultiLogger::log_debug(), and fawkes::Mutex::unlock().

◆ log_error() [1/2]

void fawkes::LibLogger::log_error ( const char *  component,
const char *  format,
  ... 
)
static

◆ log_error() [2/2]

void fawkes::LibLogger::log_error ( const char *  component,
Exception e 
)
static

Log error message.

Parameters
componentcomponent, used to distuinguish logged messages
eexception to log, exception messages will be logged

Definition at line 303 of file liblogger.cpp.

References init(), fawkes::Mutex::lock(), fawkes::MultiLogger::log_error(), and fawkes::Mutex::unlock().

◆ log_info() [1/2]

void fawkes::LibLogger::log_info ( const char *  component,
const char *  format,
  ... 
)
static

Log informational message.

Parameters
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.

Definition at line 144 of file liblogger.cpp.

References init(), fawkes::Mutex::lock(), fawkes::Mutex::unlock(), and fawkes::MultiLogger::vlog_info().

Referenced by fawkes::PluginManager::fam_event(), fawkes::PluginManager::load(), fawkes::PluginNetworkHandler::loop(), and fawkes::PluginManager::unload().

◆ log_info() [2/2]

void fawkes::LibLogger::log_info ( const char *  component,
Exception e 
)
static

Log informational message.

Parameters
componentcomponent, used to distuinguish logged messages
eexception to log, exception messages will be logged

Definition at line 275 of file liblogger.cpp.

References init(), fawkes::Mutex::lock(), fawkes::MultiLogger::log_info(), and fawkes::Mutex::unlock().

◆ log_warn() [1/2]

void fawkes::LibLogger::log_warn ( const char *  component,
const char *  format,
  ... 
)
static

Log warning message.

Parameters
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.

Definition at line 162 of file liblogger.cpp.

References init(), fawkes::Mutex::lock(), fawkes::Mutex::unlock(), and fawkes::MultiLogger::vlog_warn().

Referenced by fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_data_changed(), fawkes::BlackBoardNetHandlerInterfaceListener::bb_interface_message_received(), fawkes::ConfigNetworkHandler::client_disconnected(), fawkes::ConfigNetworkHandler::config_value_changed(), fawkes::ConfigNetworkHandler::config_value_erased(), fawkes::PluginManager::fam_event(), fawkes::YamlConfiguration::fam_event(), fawkes::NetworkConfiguration::inbound_received(), fawkes::PluginManager::init_pinfo_cache(), fawkes::BlackBoardNetworkHandler::loop(), fawkes::ConfigNetworkHandler::loop(), fawkes::BlackBoardNotifier::notify_of_data_change(), fawkes::BlackBoardNotifier::notify_of_message_received(), fawkes::BlackBoardNotifier::notify_of_reader_added(), fawkes::BlackBoardNotifier::notify_of_reader_removed(), fawkes::BlackBoardNotifier::notify_of_writer_added(), fawkes::BlackBoardNotifier::notify_of_writer_removed(), fawkes::PluginManager::PluginManager(), fawkes::BlackBoardInterfaceProxy::process_interface_message(), fawkes::PluginManager::remove_listener(), fawkes::LuaContext::restart(), fawkes::BlackBoardMessageManager::transmit(), fawkes::BlackBoardNotifier::update_listener(), fawkes::BlackBoardNetHandlerInterfaceObserver::~BlackBoardNetHandlerInterfaceObserver(), fawkes::ConfigNetworkHandler::~ConfigNetworkHandler(), and fawkes::PluginNetworkHandler::~PluginNetworkHandler().

◆ log_warn() [2/2]

void fawkes::LibLogger::log_warn ( const char *  component,
Exception e 
)
static

Log warning message.

Parameters
componentcomponent, used to distuinguish logged messages
eexception to log, exception messages will be logged

Definition at line 289 of file liblogger.cpp.

References init(), fawkes::Mutex::lock(), fawkes::MultiLogger::log_warn(), and fawkes::Mutex::unlock().

◆ remove_logger()

void fawkes::LibLogger::remove_logger ( Logger l)
static

Remove logger.

Parameters
lsub-logger to remove
See also
MultiLogger::remove_logger()

Definition at line 111 of file liblogger.cpp.

References init(), fawkes::Mutex::lock(), fawkes::MultiLogger::remove_logger(), and fawkes::Mutex::unlock().

◆ vlog_debug()

void fawkes::LibLogger::vlog_debug ( const char *  component,
const char *  format,
va_list  va 
)
static

Log debug message.

Parameters
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.
vavariadic argument list

Definition at line 199 of file liblogger.cpp.

References init(), fawkes::Mutex::lock(), fawkes::Mutex::unlock(), and fawkes::MultiLogger::vlog_debug().

◆ vlog_error()

void fawkes::LibLogger::vlog_error ( const char *  component,
const char *  format,
va_list  va 
)
static

Log error message.

Parameters
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.
vavariadic argument list

Definition at line 247 of file liblogger.cpp.

References init(), fawkes::Mutex::lock(), fawkes::Mutex::unlock(), and fawkes::MultiLogger::vlog_error().

◆ vlog_info()

void fawkes::LibLogger::vlog_info ( const char *  component,
const char *  format,
va_list  va 
)
static

Log informational message.

Parameters
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.
vavariadic argument list

Definition at line 215 of file liblogger.cpp.

References init(), fawkes::Mutex::lock(), fawkes::Mutex::unlock(), and fawkes::MultiLogger::vlog_info().

◆ vlog_warn()

void fawkes::LibLogger::vlog_warn ( const char *  component,
const char *  format,
va_list  va 
)
static

Log warning message.

Parameters
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.
vavariadic argument list

Definition at line 231 of file liblogger.cpp.

References init(), fawkes::Mutex::lock(), fawkes::Mutex::unlock(), and fawkes::MultiLogger::vlog_warn().


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