WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. Zuble QML Types   |  Zuble C++ Classes   |  Zuble Overview
Zuble  0.1
Zuble Framework C++/QML extension API
ZblLogOutput.h
Go to the documentation of this file.
1 /*
2  * Zuble - A run-time system for QML/Javascript applications
3  * Copyright (C) 2015 Bob Dinitto
4  *
5  * Filename: ZblLogOutput.h
6  * Created on: 21-May-2019
7  * Author: Bob Dinitto
8  *
9  * Zuble is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  */
24 
25 #ifndef ZBLLOGOUTPUT_H
26 #define ZBLLOGOUTPUT_H
27 
28 #include <QObject>
29 #include <QString>
30 #include <QTextStream>
31 #include "ZblLogMessage.h"
32 #include "ZblLogTextFormatterIF.h"
33 #include "ZblLogTargetIF.h"
34 #include "ZblLogFileOutIF.h"
35 
36 namespace Zbl
37 {
38 
54 class ZblLogOutput : public QObject
55 {
56  Q_OBJECT
57 
58 public:
59 
60  typedef QList<ZblLogOutput*> zLogModuleList;
61 
62  explicit ZblLogOutput(QObject *parent = nullptr) : QObject(parent){}
63  virtual ~ZblLogOutput(){}
64 
65  QString getMetadata();
66 
67  virtual void updateLogProfileParameters(const QString& profilePath) = 0;
68 
69 
70 };
71 
73 {
74  Q_OBJECT
75  Q_INTERFACES(Zbl::ZblLogTargetIF)
76 
77 public:
78  explicit ZblLogToText(QObject *parent = nullptr);
79  virtual ~ZblLogToText(){}
80 
81  virtual void updateLogProfileParameters(const QString& profilePath);
82  virtual void sendLogMessage(const ZblLogMessage& msg);
83 
84 protected:
85 
87 
88 };
89 
91 {
92  Q_OBJECT
93  //Q_INTERFACES(Zbl::ZblLogTargetIF)
94 
95 public:
96  explicit ZblLogToStdout(QObject *parent = nullptr);
97  virtual ~ZblLogToStdout(){}
98 
99  virtual void updateLogProfileParameters(const QString& profilePath);
100  //virtual void sendLogMessage(const ZblLogMessage& msg);
101 
102 };
103 
105 {
106  Q_OBJECT
107  //Q_INTERFACES(Zbl::ZblLogTargetIF Zbl::ZblLogFileOutIF)
108  Q_INTERFACES(Zbl::ZblLogFileOutIF)
109 
110 public:
111  explicit ZblLogToTextFile(QObject *parent = nullptr);
112  virtual ~ZblLogToTextFile(){}
113 
114  virtual void updateLogProfileParameters(const QString& profilePath);
115  //virtual void sendLogMessage(const ZblLogMessage& msg);
116 
117  virtual void open(const QString& filePath);
118  virtual void close();
119  virtual qlonglong size();
120  virtual void flush();
121 };
122 
123 
125 {
126  Q_OBJECT
127  Q_INTERFACES(Zbl::ZblLogTargetIF)
128 
129 public:
130  explicit ZblLogToHistory(QObject *parent = nullptr);
131  virtual ~ZblLogToHistory(){}
132 
133  virtual void updateLogProfileParameters(const QString& profilePath);
134  virtual void sendLogMessage(const ZblLogMessage& msg);
135 
136 };
137 
139 {
140  Q_OBJECT
141  Q_INTERFACES(Zbl::ZblLogTextFormatterIF)
142 
143 public:
144  explicit ZblLogFormatPlainText(QObject *parent = nullptr);
146 
147  virtual void updateLogProfileParameters(const QString& profilePath);
148  virtual QString formatLogMessage(const ZblLogMessage& msg);
149 
150 };
151 
153 {
154  Q_OBJECT
155 
156 public:
157  explicit ZblLogFormatJSONRecords(QObject *parent = nullptr);
159 
160  virtual void updateLogProfileParameters(const QString& profilePath);
161  virtual QString formatLogMessage(const ZblLogMessage& msg);
162 
163 };
164 
165 } // Zbl
166 
167 Q_DECLARE_METATYPE(Zbl::ZblLogOutput::zLogModuleList)
168 
169 #endif // ZBLLOGOUTPUT_H
virtual ~ZblLogOutput()
Definition: ZblLogOutput.h:63
ZblLogTextFormatterIF * m_formatter
Definition: ZblLogOutput.h:86
Interface for log output modules that perform text formatting operations.
QString getMetadata()
Definition: ZblLogOutput.cpp:8
virtual ~ZblLogToHistory()
Definition: ZblLogOutput.h:131
Definition: ZAndGate.cpp:6
Abstract base class for Zuble log output modules.
Definition: ZblLogOutput.h:54
Interface for logger backend target modules.
virtual ~ZblLogToText()
Definition: ZblLogOutput.h:79
ZblLogOutput(QObject *parent=nullptr)
Definition: ZblLogOutput.h:62
virtual ~ZblLogToStdout()
Definition: ZblLogOutput.h:97
virtual ~ZblLogToTextFile()
Definition: ZblLogOutput.h:112
Interface for log output modules that perform file operations.
QList< ZblLogOutput * > zLogModuleList
Definition: ZblLogOutput.h:60
virtual void updateLogProfileParameters(const QString &profilePath)=0
This class is used to transfer log messages between threads.
Definition: ZblLogMessage.h:38