DtkCore
DTK Core module
LogManager.h
1/*
2 * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd.
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 as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * any later version.
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 General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef LOGMANAGER_H
19#define LOGMANAGER_H
20
21#include <QtCore>
22
23#include "CuteLogger_global.h"
24
25DCORE_BEGIN_NAMESPACE
26
27class ConsoleAppender;
28class RollingFileAppender;
29
30class LIBDTKCORESHARED_EXPORT DLogManager
31{
32public:
33 static void registerConsoleAppender();
34 static void registerFileAppender();
35
36 static QString getlogFilePath();
37
42 static void setlogFilePath(const QString& logFilePath);
43
44 static void setLogFormat(const QString& format);
45
46private:
47 QString m_format;
48 QString m_logPath;
49 ConsoleAppender* m_consoleAppender;
50 RollingFileAppender* m_rollingFileAppender;
51
52 void initConsoleAppender();
53 void initRollingFileAppender();
54 QString joinPath(const QString& path, const QString& fileName);
55
56 inline static DLogManager* instance(){
57 static DLogManager instance;
58 return &instance;
59 }
60 explicit DLogManager();
62 DLogManager(const DLogManager &);
63 DLogManager & operator = (const DLogManager &);
64};
65
66DCORE_END_NAMESPACE
67
68#endif // LOGMANAGER_H
ConsoleAppender is the simple appender that writes the log records to the std::cerr output stream.
Definition: ConsoleAppender.h:23
DLogManager is the deepin user application log manager.
Definition: LogManager.h:31
The RollingFileAppender class extends FileAppender so that the underlying file is rolled over at a us...
Definition: RollingFileAppender.h:28