Fawkes API
Fawkes Development Version
|
Log through multiple loggers. More...
#include <>>
Public Member Functions | |
MultiLogger () | |
Constructor. More... | |
MultiLogger (Logger *logger) | |
Constructor. More... | |
virtual | ~MultiLogger () |
Destructor. More... | |
void | add_logger (Logger *logger) |
Add a logger. More... | |
void | remove_logger (Logger *logger) |
Remove logger. More... | |
virtual void | set_loglevel (LogLevel level) |
Sets the log level. More... | |
virtual void | log (LogLevel level, const char *component, const char *format,...) |
Log message of given log level. More... | |
virtual void | log_debug (const char *component, const char *format,...) |
Log debug message. More... | |
virtual void | log_info (const char *component, const char *format,...) |
Log informational message. More... | |
virtual void | log_warn (const char *component, const char *format,...) |
Log warning message. More... | |
virtual void | log_error (const char *component, const char *format,...) |
Log error message. More... | |
virtual void | log (LogLevel level, const char *component, Exception &e) |
Log exception for given log level. More... | |
virtual void | log_debug (const char *component, Exception &e) |
Log debug exception. More... | |
virtual void | log_info (const char *component, Exception &e) |
Log informational exception. More... | |
virtual void | log_warn (const char *component, Exception &e) |
Log warning exception. More... | |
virtual void | log_error (const char *component, Exception &e) |
Log error exception. More... | |
virtual void | vlog (LogLevel level, const char *component, const char *format, va_list va) |
Log message for given log level. More... | |
virtual void | vlog_debug (const char *component, const char *format, va_list va) |
Log debug message. More... | |
virtual void | vlog_info (const char *component, const char *format, va_list va) |
Log informational message. More... | |
virtual void | vlog_warn (const char *component, const char *format, va_list va) |
Log warning message. More... | |
virtual void | vlog_error (const char *component, const char *format, va_list va) |
Log error message. More... | |
virtual void | tlog (LogLevel level, struct timeval *t, const char *component, const char *format,...) |
Log message of given log level and time. More... | |
virtual void | tlog_debug (struct timeval *t, const char *component, const char *format,...) |
Log debug message for specific time. More... | |
virtual void | tlog_info (struct timeval *t, const char *component, const char *format,...) |
Log informational message for specific time. More... | |
virtual void | tlog_warn (struct timeval *t, const char *component, const char *format,...) |
Log warning message for specific time. More... | |
virtual void | tlog_error (struct timeval *t, const char *component, const char *format,...) |
Log error message for specific time. More... | |
virtual void | tlog (LogLevel level, struct timeval *t, const char *component, Exception &e) |
Log exception for given log level. More... | |
virtual void | tlog_debug (struct timeval *t, const char *component, Exception &e) |
Log debug exception for specific time. More... | |
virtual void | tlog_info (struct timeval *t, const char *component, Exception &e) |
Log informational exception for specific time. More... | |
virtual void | tlog_warn (struct timeval *t, const char *component, Exception &e) |
Log warning exception for specific time. More... | |
virtual void | tlog_error (struct timeval *t, const char *component, Exception &e) |
Log error exception for specific time. More... | |
virtual void | vtlog (LogLevel level, struct timeval *t, const char *component, const char *format, va_list va) |
Log message for given log level and time. More... | |
virtual void | vtlog_debug (struct timeval *t, const char *component, const char *format, va_list va) |
Log debug message for specific time. More... | |
virtual void | vtlog_info (struct timeval *t, const char *component, const char *format, va_list va) |
Log informational message for specific time. More... | |
virtual void | vtlog_warn (struct timeval *t, const char *component, const char *format, va_list va) |
Log warning message for specific time. More... | |
virtual void | vtlog_error (struct timeval *t, const char *component, const char *format, va_list va) |
Log error message for specific time. More... | |
![]() | |
Logger (LogLevel log_level=LL_DEBUG) | |
Constructor. More... | |
virtual | ~Logger () |
Virtual empty destructor. More... | |
virtual LogLevel | loglevel () |
Get log level. More... | |
![]() | |
virtual | ~LoggerEmployer () |
Virtual empty destructor. More... | |
Additional Inherited Members | |
![]() | |
enum | LogLevel { LL_DEBUG = 0, LL_INFO = 1, LL_WARN = 2, LL_ERROR = 4, LL_NONE = 8 } |
Log level. More... | |
![]() | |
LogLevel | log_level |
Minimum log level. More... | |
Log through multiple loggers.
It can be hand to have the opportunity to log to multiple channels, for example log to a file and via network to a remote console. This can be done with the MultiLogger. You can add an arbitrary number of loggers to log the output to. Use the minimum number of necessary loggers though because this can cause a high burden on log users if you have too many loggers.
Note that the multi logger takes over the ownership of the logger. That means that the multi logger destroys all sub-loggers when it is deleted itself. If you want to take over the loggers without destroying them you have to properly remove them before destroying the multi logger.
fawkes::MultiLogger::MultiLogger | ( | ) |
fawkes::MultiLogger::MultiLogger | ( | Logger * | logger | ) |
|
virtual |
|
virtual |
Add a logger.
logger | new sub-logger to add |
Implements fawkes::LoggerEmployer.
Definition at line 110 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Logger::log_level, fawkes::Thread::set_cancel_state(), and set_loglevel().
Referenced by fawkes::LibLogger::add_logger(), and fawkes::LoggerFactory::multilogger_instance().
|
virtual |
Log message of given log level.
level | log level |
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
Reimplemented from fawkes::Logger.
Definition at line 153 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and vtlog().
Referenced by log().
Log exception for given log level.
level | log level |
component | component, used to distuinguish logged messages |
e | exception to log, exception messages will be logged |
Reimplemented from fawkes::Logger.
Definition at line 258 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, log(), and fawkes::Thread::set_cancel_state().
|
virtual |
Log debug message.
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
Implements fawkes::Logger.
Definition at line 174 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and vlog_debug().
Referenced by fawkes::AbstractSearch::AbstractSearch(), MongoLogBlackboardThread::bb_interface_created(), RobotStatePublisherThread::bb_interface_created(), BBLoggerThread::bb_interface_message_received(), fawkes::FawkesMainThread::FawkesMainThread(), AmclThread::init(), fawkes::gpp::GologppThread::init(), JoystickBlackBoardLogger::JoystickBlackBoardLogger(), fawkes::LaserOccupancyGrid::LaserOccupancyGrid(), fawkes::LibLogger::log_debug(), fawkes::FawkesMainThread::loop(), MiniImageProducer::MiniImageProducer(), and BlackBoardSynchronizationThread::writer_added().
|
virtual |
Log debug exception.
component | component, used to distuinguish logged messages |
e | exception to log, exception messages will be logged |
Implements fawkes::Logger.
Definition at line 273 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and tlog_debug().
|
virtual |
Log error message.
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
Implements fawkes::Logger.
Definition at line 237 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and vlog_error().
Referenced by LaserPointCloudThread::bb_interface_created(), BBLoggerThread::bb_interface_data_changed(), fawkes::LibLogger::log_error(), fawkes::FawkesMainThread::loop(), AmclThread::loop(), MiniImageProducer::MiniImageProducer(), fawkes::FawkesMainThread::once(), fawkes::gpp::GologppThread::once(), BlackBoardSynchronizationThread::writer_added(), and BlackBoardSynchronizationThread::writer_removed().
|
virtual |
Log error exception.
component | component, used to distuinguish logged messages |
e | exception to log, exception messages will be logged |
Implements fawkes::Logger.
Definition at line 319 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and tlog_error().
|
virtual |
Log informational message.
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
Implements fawkes::Logger.
Definition at line 195 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and vlog_info().
Referenced by RosLaserScanThread::bb_interface_created(), DynamixelDriverThread::bb_interface_message_received(), KatanaActThread::bb_interface_message_received(), PanTiltDirectedPerceptionThread::bb_interface_message_received(), PanTiltRX28Thread::bb_interface_message_received(), PanTiltSonyEviD100PThread::bb_interface_message_received(), BBLoggerThread::bb_interface_writer_removed(), fawkes::FawkesMainThread::FawkesMainThread(), AmclThread::init(), GazsimTimesourceThread::init(), fawkes::gpp::GologppThread::init(), protoboard::pb_converter< ProtoT, IfaceT >::init(), MongoDBClientConfig::log(), fawkes::LibLogger::log_info(), AmclThread::loop(), MongoDBClientConfig::MongoDBClientConfig(), and fawkes::gpp::GologppThread::once().
|
virtual |
Log informational exception.
component | component, used to distuinguish logged messages |
e | exception to log, exception messages will be logged |
Implements fawkes::Logger.
Definition at line 289 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and tlog_info().
|
virtual |
Log warning message.
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
Implements fawkes::Logger.
Definition at line 216 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and vlog_warn().
Referenced by LaserPointCloudThread::bb_interface_created(), MongoLogBlackboardThread::bb_interface_created(), RobotStatePublisherThread::bb_interface_created(), RosJointThread::bb_interface_created(), RosLaserScanThread::bb_interface_created(), RosPosition3DThread::bb_interface_created(), RosTfThread::bb_interface_created(), ClipsRmTrigger::callback(), AmclThread::init(), fawkes::SyncPoint::lock_until_next_wait(), fawkes::LibLogger::log_warn(), fawkes::FawkesMainThread::loop(), AmclThread::loop(), Roomba500Thread::WorkerThread::loop(), MiniImageProducer::produce(), BlackBoardSynchronizationThread::writer_added(), and BlackBoardSynchronizationThread::writer_removed().
|
virtual |
Log warning exception.
component | component, used to distuinguish logged messages |
e | exception to log, exception messages will be logged |
Implements fawkes::Logger.
Definition at line 304 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and tlog_warn().
|
virtual |
Remove logger.
logger | Sub-logger to remove |
Implements fawkes::LoggerEmployer.
Definition at line 128 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, and fawkes::Thread::set_cancel_state().
Referenced by fawkes::LibLogger::remove_logger().
|
virtual |
Sets the log level.
The log level determines the minimum log level. If a message is logged that is below this level the message is ignored.
level | new log level |
Reimplemented from fawkes::Logger.
Definition at line 139 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Logger::log_level, and fawkes::Thread::set_cancel_state().
Referenced by add_logger(), and fawkes::LoggerFactory::multilogger_instance().
|
virtual |
Log message of given log level and time.
t | time |
level | log level |
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
Reimplemented from fawkes::Logger.
Definition at line 424 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and vtlog().
Referenced by tlog().
|
virtual |
Log exception for given log level.
t | time |
level | log level |
component | component, used to distuinguish logged messages |
e | exception to log, exception messages will be logged |
Reimplemented from fawkes::Logger.
Definition at line 517 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and tlog().
|
virtual |
Log debug message for specific time.
t | time for this message to log |
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
Implements fawkes::Logger.
Definition at line 442 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and vlog_debug().
Referenced by log_debug().
|
virtual |
Log debug exception for specific time.
t | time for this message to log |
component | component, used to distuinguish logged messages |
e | exception to log, exception messages will be logged |
Implements fawkes::Logger.
Definition at line 530 of file multi.cpp.
References tlog_error().
|
virtual |
Log error message for specific time.
t | time for this message to log |
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
Implements fawkes::Logger.
Definition at line 498 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and vtlog_error().
Referenced by log_error(), tlog_debug(), tlog_error(), tlog_info(), and tlog_warn().
|
virtual |
Log error exception for specific time.
t | time for this message to log |
component | component, used to distuinguish logged messages |
e | exception to log, exception messages will be logged |
Implements fawkes::Logger.
Definition at line 564 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and tlog_error().
|
virtual |
Log informational message for specific time.
t | time for this message to log |
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
Implements fawkes::Logger.
Definition at line 460 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and vtlog_info().
Referenced by log_info().
|
virtual |
Log informational exception for specific time.
t | time for this message to log |
component | component, used to distuinguish logged messages |
e | exception to log, exception messages will be logged |
Implements fawkes::Logger.
Definition at line 538 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and tlog_error().
|
virtual |
Log warning message for specific time.
t | time for this message to log |
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
Implements fawkes::Logger.
Definition at line 479 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and vtlog_warn().
Referenced by log_warn().
|
virtual |
Log warning exception for specific time.
t | time for this message to log |
component | component, used to distuinguish logged messages |
e | exception to log, exception messages will be logged |
Implements fawkes::Logger.
Definition at line 551 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and tlog_error().
|
virtual |
Log message for given log level.
level | log level |
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
va | variadic argument list |
Reimplemented from fawkes::Logger.
Definition at line 334 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, and fawkes::Thread::set_cancel_state().
|
virtual |
Log debug message.
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
va | variable argument list |
Implements fawkes::Logger.
Definition at line 352 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and vtlog_debug().
Referenced by fawkes::LibLogger::log_debug(), log_debug(), tlog_debug(), and fawkes::LibLogger::vlog_debug().
|
virtual |
Log error message.
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
va | variable argument list |
Implements fawkes::Logger.
Definition at line 406 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and vtlog_error().
Referenced by fawkes::LibLogger::log_error(), log_error(), and fawkes::LibLogger::vlog_error().
|
virtual |
Log informational message.
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
va | variable argument list |
Implements fawkes::Logger.
Definition at line 370 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and vtlog_info().
Referenced by fawkes::LibLogger::log_info(), log_info(), and fawkes::LibLogger::vlog_info().
|
virtual |
Log warning message.
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
va | variable argument list |
Implements fawkes::Logger.
Definition at line 388 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, fawkes::Thread::set_cancel_state(), and vtlog_warn().
Referenced by fawkes::LibLogger::log_warn(), log_warn(), and fawkes::LibLogger::vlog_warn().
|
virtual |
Log message for given log level and time.
level | log level |
t | time |
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
va | variadic argument list |
Reimplemented from fawkes::Logger.
Definition at line 577 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, and fawkes::Thread::set_cancel_state().
|
virtual |
Log debug message for specific time.
t | time for this message to log |
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
va | variable argument list |
Implements fawkes::Logger.
Definition at line 597 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, and fawkes::Thread::set_cancel_state().
Referenced by vlog_debug().
|
virtual |
Log error message for specific time.
t | time for this message to log |
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
va | variable argument list |
Implements fawkes::Logger.
Definition at line 645 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, and fawkes::Thread::set_cancel_state().
Referenced by tlog_error(), and vlog_error().
|
virtual |
Log informational message for specific time.
t | time for this message to log |
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
va | variable argument list |
Implements fawkes::Logger.
Definition at line 613 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, and fawkes::Thread::set_cancel_state().
Referenced by tlog_info(), and vlog_info().
|
virtual |
Log warning message for specific time.
t | time for this message to log |
component | component, used to distuinguish logged messages |
format | format of the message, see man page of sprintf for available tokens. |
va | variable argument list |
Implements fawkes::Logger.
Definition at line 629 of file multi.cpp.
References fawkes::Thread::CANCEL_DISABLED, and fawkes::Thread::set_cancel_state().
Referenced by tlog_warn(), and vlog_warn().