humoto
|
Threaded logger: any data sent to this logger is wrapped in a message and pushed to a queue, the queue is processed in a separate thread. Hence, time consuming output does not delay execution of the main thread(s).
#include <logger.h>
Public Member Functions | |
Logger (const std::size_t thread_sleep_ms=default_thread_sleep_ms_) | |
Constructor. More... | |
Logger (std::ostream &output_stream, const std::size_t thread_sleep_ms=default_thread_sleep_ms_) | |
Constructor. More... | |
Logger (const std::string &output_filename, const std::size_t thread_sleep_ms=default_thread_sleep_ms_) | |
Constructor. More... | |
~Logger () | |
Destructor. More... | |
void | initialize (std::ostream &output_stream) |
initialize More... | |
void | initialize (const std::string &output_filename) |
initialize More... | |
void | initialize (std::ostream &output_stream, const std::size_t thread_sleep_ms=default_thread_sleep_ms_) |
initialize More... | |
void | initialize (const std::string &output_filename, const std::size_t thread_sleep_ms=default_thread_sleep_ms_) |
initialize More... | |
template<typename t_Data > | |
void | log (const t_Data &data, EIGENTOOLS_EIGENTYPE_DISABLER_TYPE(t_Data) *dummy=NULL) |
Log raw data. More... | |
template<typename t_Derived > | |
void | log (const Eigen::DenseBase< t_Derived > &matrix) |
Log entry (Eigen matrix) More... | |
void | log (const char *string) |
Log raw data (char string) More... | |
template<typename t_Data > | |
void | log (const LogEntryName &name, const t_Data &data, EIGENTOOLS_EIGENTYPE_DISABLER_TYPE(t_Data) *dummy=NULL) |
Log data (fundamental types) More... | |
template<typename t_Derived > | |
void | log (const LogEntryName &name, const Eigen::DenseBase< t_Derived > &matrix) |
Log entry (Eigen matrix) More... | |
void | log (const LogEntryName &name, const char *string) |
Log data (char string) More... | |
Public Attributes | |
bool | interrupted_ |
std::queue< LogMessageBase * > | message_queue_ |
boost::mutex | message_queue_mutex_ |
boost::thread | processor_thread_ |
std::size_t | thread_sleep_ms_ |
Static Public Attributes | |
static const std::size_t | default_thread_sleep_ms_ = 2 |
Protected Attributes | |
std::ostream * | output_stream_ |
Output stream. More... | |
Private Member Functions | |
void | interrupt () |
Stop the logging thread if necessary. More... | |
void | processQueue () |
This function is running in a separate thread. More... | |
void | pushMessage (LogMessageBase *msg) |
Push message to a queue. More... | |
void | start () |
Start the thread. More... | |
|
inlineexplicit |
|
inline |
|
inline |
|
inlineinherited |
|
inlineinherited |
|
inline |
|
inline |
|
inlineprivate |
|
inline |
Log raw data.
t_Data | data type |
[in] | data | |
[in] | dummy | dummy parameter for enabling/disabling of the template |
|
inline |
|
inline |
|
inline |
Log data (fundamental types)
t_Data | data type |
[in] | name | |
[in] | data | |
[in] | dummy | dummy parameter for enabling/disabling of the template |
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
static |
std::queue<LogMessageBase *> humoto::Logger::message_queue_ |
|
protectedinherited |