My Project
Public Member Functions | Private Attributes | List of all members
uuid::log::Handler Class Referenceabstract

Logger handler used to process log messages. More...

#include <uuid/log.h>

Inheritance diagram for uuid::log::Handler:
Inheritance graph
[legend]
Collaboration diagram for uuid::log::Handler:
Collaboration graph
[legend]

Public Member Functions

virtual void operator<< (std::shared_ptr< Message > message)=0
 Add a new log message. More...
 

Private Attributes

friend Logger
 Logger needs to be able to access the private reference to the registered log handlers. More...
 
std::weak_ptr< std::map< Handler *, Level > > handlers_
 Reference to registered log handlers. More...
 

Detailed Description

Logger handler used to process log messages.

Since
1.0.0

Definition at line 290 of file log.h.

Member Function Documentation

◆ operator<<()

virtual void uuid::log::Handler::operator<< ( std::shared_ptr< Message message)
pure virtual

Add a new log message.

This should normally be put in a queue instead of being processed immediately so that log messages have minimal impact at the time of use.

Handlers must avoid holding a lock on a mutex used for adding messages while processing those messages. Release the lock while performing the processing.

Queues should have a maximum size and discard the oldest message when full.

It is not safe for the handler to directly or indirectly do any of the following while this function is being called:

  • Log a message.
  • Read the log level of any handler.
  • Modify the log level of any handler.
  • Unregister any handler.
Parameters
[in]messageNew log message, shared by all handlers.
Since
1.0.0

Implemented in uuid::syslog::SyslogService, uuid::console::Shell, and uuid::log::PrintHandler.

Member Data Documentation

◆ handlers_

std::weak_ptr<std::map<Handler*,Level> > uuid::log::Handler::handlers_
private

Reference to registered log handlers.

Used in the destructor to safely unregister the handler even if the underlying map has already been destroyed.

Since
2.1.2

Definition at line 339 of file log.h.

◆ Logger

friend uuid::log::Handler::Logger
private

Logger needs to be able to access the private reference to the registered log handlers.

Since
2.1.2

Definition at line 297 of file log.h.


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