DtkCore
DTK Core module
AbstractStringAppender.h
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 ABSTRACTSTRINGAPPENDER_H
15#define ABSTRACTSTRINGAPPENDER_H
16
17// Local
18#include "CuteLogger_global.h"
19#include <AbstractAppender.h>
20
21// Qt
22#include <QReadWriteLock>
23
24DCORE_BEGIN_NAMESPACE
25
26class CUTELOGGERSHARED_EXPORT AbstractStringAppender : public AbstractAppender
27{
28 public:
30
31 virtual QString format() const;
32 void setFormat(const QString&);
33
34 static QString stripFunctionName(const char*);
35
36 protected:
37 QString formattedString(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file, int line,
38 const char* function, const QString& category, const QString& message) const;
39
40 private:
41 static QByteArray qCleanupFuncinfo(const char*);
42
43 QString m_format;
44 mutable QReadWriteLock m_formatLock;
45};
46
47DCORE_END_NAMESPACE
48
49#endif // ABSTRACTSTRINGAPPENDER_H
The AbstractAppender class provides an abstract base class for writing a log entries.
Definition: AbstractAppender.h:27
The AbstractStringAppender class provides a convenient base for appenders working with plain text for...
Definition: AbstractStringAppender.h:27
LogLevel
Describes the possible severity levels of the log records
Definition: Logger.h:83