Belle II Software  release-08-01-10
LogConnectionFilter Class Referencefinal

Implements a log connection that filters repeated messages. More...

#include <LogConnectionFilter.h>

Inheritance diagram for LogConnectionFilter:
Collaboration diagram for LogConnectionFilter:

Public Member Functions

 LogConnectionFilter (LogConnectionBase *logConnection)
 The constructor. More...
 
virtual ~LogConnectionFilter ()
 The LogConnectionFilter destructor.
 
bool sendMessage (const LogMessage &message) override
 Sends a log message. More...
 
bool isConnected () override
 Returns true if the log connection could be established. More...
 
void finalizeOnAbort () override
 Finalize on Abort: make sure last repetition is printed if there is any and that connected connection is also finalized.
 

Private Member Functions

void printRepetitions ()
 If there are repeated messages print the number of repetitions. More...
 

Private Attributes

std::unique_ptr< LogConnectionBasem_logConnection
 The actual log connection.
 
LogMessage m_previousMessage
 The previous log message.
 
int m_repeatCounter
 Counter for repeated messages.
 

Detailed Description

Implements a log connection that filters repeated messages.

This connection can be used to prevent printing of the same message again and again. Messages are suppressed if they match with the one previously sent.

Definition at line 28 of file LogConnectionFilter.h.

Constructor & Destructor Documentation

◆ LogConnectionFilter()

LogConnectionFilter ( LogConnectionBase logConnection)
explicit

The constructor.

Parameters
logConnectionThe log connection that actually prints the messages.

Definition at line 14 of file LogConnectionFilter.cc.

14  :
15  m_logConnection(logConnection),
16  m_previousMessage(LogConfig::c_Default, "", "", "", "", 0),
18 {
19 }
@ c_Default
Default: use globally configured log level.
Definition: LogConfig.h:32
std::unique_ptr< LogConnectionBase > m_logConnection
The actual log connection.
int m_repeatCounter
Counter for repeated messages.
LogMessage m_previousMessage
The previous log message.

Member Function Documentation

◆ isConnected()

bool isConnected ( )
overridevirtual

Returns true if the log connection could be established.

Returns
True if the log connection could be established.

Implements LogConnectionBase.

Definition at line 28 of file LogConnectionFilter.cc.

◆ printRepetitions()

void printRepetitions ( )
private

If there are repeated messages print the number of repetitions.


Definition at line 51 of file LogConnectionFilter.cc.

◆ sendMessage()

bool sendMessage ( const LogMessage message)
overridevirtual

Sends a log message.

Parameters
messageThe log message object.
Returns
Returns true if the message could be send.

Implements LogConnectionBase.

Definition at line 34 of file LogConnectionFilter.cc.


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