ealogger
ealogger is a c++ library that provides a blazing fast and easy to use logging mechanism
Public Member Functions | List of all members
ealogger::LogQueue Class Reference

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< LogMessagepop ()
 Get the next LogMessage object in the Queue and remove it. More...
 
bool empty ()
 Check if the Queue is empty. More...
 

Detailed Description

The LogQueue class represents a threadsafe queue ealogger uses to store log messages.

Author
Christian Rapp (crapp)

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.

Member Function Documentation

bool ealogger::LogQueue::empty ( )

Check if the Queue is empty.

Returns
True if it is empty, otherwise false
std::shared_ptr< eal::LogMessage > ealogger::LogQueue::pop ( )

Get the next LogMessage object in the Queue and remove it.

Returns
Shared pointer LogMessage object
void ealogger::LogQueue::push ( std::shared_ptr< LogMessage m)

Push LogMessage in the Queue.

Parameters
mLogMessage object as shared pointer

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