SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
filelogger.h
Go to the documentation of this file.
1 
6 #ifndef FILELOGGER_H
7 #define FILELOGGER_H
8 
9 #include <QtGlobal>
10 #include <QSettings>
11 #include <QFile>
12 #include <QMutex>
13 #include <QBasicTimer>
14 #include "logglobal.h"
15 #include "logger.h"
16 #include "fileloggersettings.h"
17 
18 #include "export.h"
19 
20 namespace qtwebapp {
21 
54 class LOGGING_API FileLogger : public Logger {
55  Q_OBJECT
56  Q_DISABLE_COPY(FileLogger)
57 public:
58 
68  FileLogger(QSettings* settings, const int refreshInterval=10000, QObject* parent = 0);
69 
76  FileLogger(const FileLoggerSettings& settings, const int refreshInterval=10000, QObject* parent = 0);
77 
81  virtual ~FileLogger();
82 
87  FileLoggerSettings getFileLoggerSettings() const { return fileLoggerSettings; }
88 
93  void setFileLoggerSettings(const FileLoggerSettings& settings) { fileLoggerSettings = settings; }
94 
96  virtual void write(const LogMessage* logMessage);
97 
98 protected:
99 
106  void timerEvent(QTimerEvent* event);
107 
108 private:
109 
111  QString fileName;
112 
114  long maxSize;
115 
118 
120  QSettings* settings;
121 
124 
126  QFile* file;
127 
129  QBasicTimer refreshTimer;
130 
132  QBasicTimer flushTimer;
133 
136 
138  void open();
139 
141  void close();
142 
144  void rotate();
145 
150  void refreshSettings();
151 
155  void refreshQtSettings();
156 
160  void refreshFileLogSettings();
161 
162 };
163 
164 } // end of namespace
165 
166 #endif // FILELOGGER_H
void setFileLoggerSettings(const FileLoggerSettings &settings)
Definition: filelogger.h:93
QSettings * settings
Definition: filelogger.h:120
FileLoggerSettings getFileLoggerSettings() const
Definition: filelogger.h:87
QBasicTimer refreshTimer
Definition: filelogger.h:129
#define LOGGING_API
Definition: export.h:100
FileLoggerSettings fileLoggerSettings
Definition: filelogger.h:123
QBasicTimer flushTimer
Definition: filelogger.h:132