summaryrefslogtreecommitdiff
path: root/utils/rbutilqt/logger/include/FileAppender.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/rbutilqt/logger/include/FileAppender.h')
-rw-r--r--utils/rbutilqt/logger/include/FileAppender.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/utils/rbutilqt/logger/include/FileAppender.h b/utils/rbutilqt/logger/include/FileAppender.h
new file mode 100644
index 0000000000..ab9e12a91d
--- /dev/null
+++ b/utils/rbutilqt/logger/include/FileAppender.h
@@ -0,0 +1,49 @@
1/*
2 Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com)
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License version 2.1
6 as published by the Free Software Foundation and appearing in the file
7 LICENSE.LGPL included in the packaging of this file.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13*/
14#ifndef FILEAPPENDER_H
15#define FILEAPPENDER_H
16
17// Logger
18#include "CuteLogger_global.h"
19#include <AbstractStringAppender.h>
20
21// Qt
22#include <QFile>
23#include <QTextStream>
24
25
26class CUTELOGGERSHARED_EXPORT FileAppender : public AbstractStringAppender
27{
28 public:
29 FileAppender(const QString& fileName = QString());
30 ~FileAppender();
31
32 QString fileName() const;
33 void setFileName(const QString&);
34
35 bool reopenFile();
36
37 protected:
38 virtual void append(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file, int line,
39 const char* function, const QString& category, const QString& message);
40 bool openFile();
41 void closeFile();
42
43 private:
44 QFile m_logFile;
45 QTextStream m_logStream;
46 mutable QMutex m_logFileMutex;
47};
48
49#endif // FILEAPPENDER_H