Belle II Software light-2406-ragdoll
LogConnectionFilter.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <framework/logging/LogConnectionBase.h>
12#include <framework/logging/LogMessage.h>
13
14#include <memory>
15
16namespace Belle2 {
29
30 public:
31
37 explicit LogConnectionFilter(LogConnectionBase* logConnection);
38
42 virtual ~LogConnectionFilter();
43
50 bool sendMessage(const LogMessage& message) override;
51
57 bool isConnected() override;
58
62 void finalizeOnAbort() override
63 {
65 m_logConnection->finalizeOnAbort();
66 }
67
68 private:
70 void printRepetitions();
71
72 std::unique_ptr<LogConnectionBase> m_logConnection;
75 };
76
78} // end namespace Belle2
Abstract base class for the different types of log connections.
Implements a log connection that filters repeated messages.
std::unique_ptr< LogConnectionBase > m_logConnection
The actual log connection.
void printRepetitions()
If there are repeated messages print the number of repetitions.
int m_repeatCounter
Counter for repeated messages.
virtual ~LogConnectionFilter()
The LogConnectionFilter destructor.
LogMessage m_previousMessage
The previous log message.
bool isConnected() override
Returns true if the log connection could be established.
bool sendMessage(const LogMessage &message) override
Sends a log message.
void finalizeOnAbort() override
Finalize on Abort: make sure last repetition is printed if there is any and that connected connection...
The LogMessage class.
Definition: LogMessage.h:29
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24