Debian Codegraph @

include/AbstractAppender.h

raw
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 ABSTRACTAPPENDER_H
15 #define ABSTRACTAPPENDER_H
16
17 #include "dlog_global.h"
18 #include "Logger.h"
19
20 #include <QMutex>
21
22 DLOG_CORE_BEGIN_NAMESPACE
23
24 class LIBDLOG_SHARED_EXPORT AbstractAppender
25 {
26 public:
27 AbstractAppender();
28 virtual ~AbstractAppender();
29
30 Logger::LogLevel detailsLevel() const;
31 void setDetailsLevel(Logger::LogLevel level);
32 void setDetailsLevel(const QString &level);
33
34 void write(const QDateTime &time, Logger::LogLevel level, const char *file, int line,
35 const char *func, const QString &category, const QString &msg);
36
37 protected:
38 virtual void append(const QDateTime &time, Logger::LogLevel level, const char *file, int line,
39 const char *func, const QString &category, const QString &msg) = 0;
40
41 private:
42 QMutex m_writeMutex;
43
44 Logger::LogLevel m_detailsLevel;
45 mutable QMutex m_detailsLevelMutex;
46 };
47
48 DLOG_CORE_END_NAMESPACE
49 #endif // ABSTRACTAPPENDER_H