-
Notifications
You must be signed in to change notification settings - Fork 3
/
debug.h
67 lines (60 loc) · 1.85 KB
/
debug.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef DEBUG_H
#define DEBUG_H
#include <QtCore>
namespace DebugLevel {
enum Level{
None,
Error,
Category,
Function,
Comment,
Database,
Debug,
Construktor,
Destruktor,
All
};
}
class Debug
{
public:
//
// Debug-Modus steuern
static void enableDebugging (const bool &flag);
// Den Pfad für das Debuggen setzen
static void setDebugPath (const QString &path);
// Neue Kategorie hinzufügen
static void addCategory (const QString &cat);
// Welches Loglevel
static void setDebugLevel (DebugLevel::Level level);
// Zeit mit ausgeben
static void enableDateTime (const bool &flag);
// Uhrezit auch in Millisekunden angeben
static void enableMSecs (const bool &flag);
// Eine Kategorie vom Stack holen
static void endCategory ();
// Den Stack leeren
static void clearCategories ();
// Die eigentliche Logmeldung
static void log (const QString &message, DebugLevel::Level level=DebugLevel::Comment, const QString &filename=QString(""));
// Wrapper für Fehlermeldungen
static void error (const QString &message, const QString &filename=QString(""));
// Wrapper für Funktionen
static void function (const QString &message, const QString &filename=QString(""));
private:
Debug ();
//
// Ist das Debuging aktiviert
static bool debugEnabled;
// Der Path zum Verzeichnis in dem die Debug-Dateien erstellt werden sollen
static QString debugPath;
// Das aktuelle Loglevel
static int debugLevel;
// Soll die Zeit angegeben werden
static bool dateTimeEnabled;
// Millisekunden
static bool mSecsEnabled;
// Kategorien Stapel
static QStack<QString> debugCategories;
};
#endif // DEBUG_H