Akonadi

tracerinterface.h
1 /***************************************************************************
2  * SPDX-FileCopyrightText: 2006 Tobias Koenig <[email protected]> *
3  * *
4  * SPDX-License-Identifier: LGPL-2.0-or-later *
5  ***************************************************************************/
6 
7 #pragma once
8 
9 #include <QtGlobal>
10 
11 class QByteArray;
12 class QString;
13 
14 namespace Akonadi
15 {
16 namespace Server
17 {
18 /**
19  * This interface can be reimplemented to deliver tracing information
20  * of the akonadi server to the outside.
21  *
22  * Possible implementations:
23  * - log file
24  * - dbus signals
25  * - live gui
26  */
28 {
29 public:
30  enum ConnectionFormat {
31  DebugString,
32  Json,
33  };
34 
35  virtual ~TracerInterface() = default;
36 
37  /**
38  * This method is called whenever a new data (imap) connection to the akonadi server
39  * is established.
40  *
41  * @param identifier The unique identifier for this connection. All input and output
42  * messages for this connection will have the same identifier.
43  *
44  * @param msg A message specific string.
45  */
46  virtual void beginConnection(const QString &identifier, const QString &msg) = 0;
47 
48  /**
49  * This method is called whenever a data (imap) connection to akonadi server is
50  * closed.
51  *
52  * @param identifier The unique identifier of this connection.
53  * @param msg A message specific string.
54  */
55  virtual void endConnection(const QString &identifier, const QString &msg) = 0;
56 
57  /**
58  * This method is called whenever the akonadi server retrieves some data from the
59  * outside.
60  *
61  * @param identifier The unique identifier of the connection on which the data
62  * is retrieved.
63  * @param msg A message specific string.
64  */
65  virtual void connectionInput(const QString &identifier, const QByteArray &msg) = 0;
66 
67  /**
68  * This method is called whenever the akonadi server sends some data out to a client.
69  *
70  * @param identifier The unique identifier of the connection on which the
71  * data is send.
72  * @param msg A message specific string.
73  */
74  virtual void connectionOutput(const QString &identifier, const QByteArray &msg) = 0;
75 
76  /**
77  * This method is called whenever a dbus signal is emitted on the bus.
78  *
79  * @param signalName The name of the signal being sent.
80  * @param msg A message specific string.
81  */
82  virtual void signal(const QString &signalName, const QString &msg) = 0;
83 
84  /**
85  * This method is called whenever a component wants to output a warning.
86  */
87  virtual void warning(const QString &componentName, const QString &msg) = 0;
88 
89  /**
90  * This method is called whenever a component wants to output an error.
91  */
92  virtual void error(const QString &componentName, const QString &msg) = 0;
93 
94  virtual ConnectionFormat connectionFormat() const
95  {
96  return DebugString;
97  }
98 
99 protected:
100  explicit TracerInterface() = default;
101 
102 private:
103  Q_DISABLE_COPY_MOVE(TracerInterface)
104 };
105 
106 } // namespace Server
107 } // namespace Akonadi
108 
virtual void endConnection(const QString &identifier, const QString &msg)=0
This method is called whenever a data (imap) connection to akonadi server is closed.
virtual void connectionOutput(const QString &identifier, const QByteArray &msg)=0
This method is called whenever the akonadi server sends some data out to a client.
virtual void connectionInput(const QString &identifier, const QByteArray &msg)=0
This method is called whenever the akonadi server retrieves some data from the outside.
This interface can be reimplemented to deliver tracing information of the akonadi server to the outsi...
virtual void signal(const QString &signalName, const QString &msg)=0
This method is called whenever a dbus signal is emitted on the bus.
virtual void warning(const QString &componentName, const QString &msg)=0
This method is called whenever a component wants to output a warning.
virtual void error(const QString &componentName, const QString &msg)=0
This method is called whenever a component wants to output an error.
virtual void beginConnection(const QString &identifier, const QString &msg)=0
This method is called whenever a new data (imap) connection to the akonadi server is established.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jul 2 2022 06:41:49 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.