comparison src/debugging/TSLogger.h @ 754:4ec2ac09969d

Renamed the logger class and put it into a namespace for later universal tool reuse. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@1031 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Tue, 21 Dec 2010 23:07:50 +0000
parents
children f3631db17328
comparison
equal deleted inserted replaced
753:e64c04dc6f61 754:4ec2ac09969d
1 /***************************************************************************
2 * Copyright (C) 2006-2010 by Thomas Schweitzer *
3 * thomas-schweitzer(at)arcor.de *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License version 2.0 as *
7 * published by the Free Software Foundation. *
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 General Public License *
15 * along with this program in the file LICENSE.GPL; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 ***************************************************************************/
19
20 #ifndef TSLogger_H
21 #define TSLogger_H
22
23 #include <QDialog>
24 #include <QFile>
25
26 namespace Ui {
27 class TSLoggerDialog;
28 }
29
30 namespace tschweitzer { namespace debugging {
31
32 #define TSLoggerInfoMsg QtMsgType(4)
33
34 class TSLogger : public QDialog
35 {
36 Q_OBJECT
37
38 public:
39 static TSLogger* getInstance(int verboseLevel);
40 static TSLogger* getInstance();
41 static void messageHandler(QtMsgType type, const char *msg);
42 static void deleteInstance();
43 void setVerboseLevel(int level);
44
45 private slots:
46 void openLogFileFolder();
47
48 private:
49 Ui::TSLoggerDialog *_TSLoggerDialogForm;
50
51 enum LogFileInitState { NOTINITIALZED, INITIALIZING, INITIALZED } _logFileInitState;
52 TSLogger(int verboseLevel);
53 void writeToLogFile(const QString &message);
54
55 static TSLogger* _instance;
56 QtMsgType _verboseLevel;
57 QFile _logFile;
58 QStringList _messageQueue;
59 };
60
61 }} // namespace tschweitzer::debugging
62
63 #endif // TSLogger_H