ealogger
ealogger is a c++ library that provides a blazing fast and easy to use logging mechanism
|
The LogQueue class represents a threadsafe queue ealogger uses to store log messages. More...
#include <logqueue.h>
Public Member Functions | |
LogQueue () | |
LogQueue constructor. | |
void | push (std::shared_ptr< LogMessage > m) |
Push LogMessage in the Queue. More... | |
std::shared_ptr< LogMessage > | pop () |
Get the next LogMessage object in the Queue and remove it. More... | |
bool | empty () |
Check if the Queue is empty. More... | |
The LogQueue class represents a threadsafe queue ealogger uses to store log messages.
A big problem of most logger implementations is performance. If you are logging many messages in a short time your logger may slow down the whole application. ealogger can write to an iostream, a fstream or a syslog sink at the same time. These operations take time. To minimize the overhead created by writing to a stream we are using a threadsafe queue. This queue is filled by the logger and a separate thread object and works with the FIFO principle and pops the messages from the queue and hands them over to the sinks.
Please note this is not a lock free solution so far.
bool ealogger::LogQueue::empty | ( | ) |
Check if the Queue is empty.
std::shared_ptr< eal::LogMessage > ealogger::LogQueue::pop | ( | ) |
Get the next LogMessage object in the Queue and remove it.
void ealogger::LogQueue::push | ( | std::shared_ptr< LogMessage > | m | ) |
Push LogMessage in the Queue.
m | LogMessage object as shared pointer |