Belle II Software  release-05-02-19
LogConnectionJSON.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2018 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Ritter *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/logging/LogConnectionConsole.h>
14 
15 namespace Belle2 {
28  class LogConnectionJSON final: public LogConnectionBase {
29 
30  public:
31 
36  explicit LogConnectionJSON(bool complete = false);
37 
39  ~LogConnectionJSON() override = default;
40 
47  bool sendMessage(const LogMessage& message) override;
48 
52  bool isConnected() override { return m_console.isConnected(); }
53 
55  void finalizeOnAbort() override
56  {
58  }
59 
60  private:
64  bool m_complete;
65  };
66 
68 } // end namespace Belle2
Belle2::LogConnectionJSON::isConnected
bool isConnected() override
Returns true if the connection to the text file could be established.
Definition: LogConnectionJSON.h:60
Belle2::LogConnectionConsole::finalizeOnAbort
void finalizeOnAbort() override
Make sure output is flushed on abort.
Definition: LogConnectionConsole.cc:100
Belle2::LogConnectionJSON::m_console
LogConnectionConsole m_console
LogConnection to the console we use to dispatch the json objects.
Definition: LogConnectionJSON.h:70
Belle2::LogConnectionJSON::m_complete
bool m_complete
If true ignore the log message format settings and output everything.
Definition: LogConnectionJSON.h:72
Belle2::LogConnectionJSON::~LogConnectionJSON
~LogConnectionJSON() override=default
The LogConnectionJSONFile destructor.
Belle2::LogConnectionConsole::isConnected
bool isConnected() override
Returns true if the connection to the io stream could be established.
Definition: LogConnectionConsole.cc:37
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::LogConnectionJSON::LogConnectionJSON
LogConnectionJSON(bool complete=false)
The constructor.
Definition: LogConnectionJSON.cc:29
Belle2::LogConnectionJSON::finalizeOnAbort
void finalizeOnAbort() override
Finalize on Abort: make sure that connected connection is finalized.
Definition: LogConnectionJSON.h:63
Belle2::LogConnectionConsole
Implements a log connection to an IO Stream.
Definition: LogConnectionConsole.h:34
Belle2::LogMessage
The LogMessage class.
Definition: LogMessage.h:39
Belle2::LogConnectionJSON::sendMessage
bool sendMessage(const LogMessage &message) override
Sends a log message.
Definition: LogConnectionJSON.cc:33