forked from avartak/TkCommissioner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Debug.h
82 lines (68 loc) · 2.93 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef DEBUG_H
#define DEBUG_H
#include <QDebug>
/** \Class Debug
*
* \brief Singleton class to enable/disable debugging information at
* run time throughout the application with the need to recompile
*/
class Debug {
private:
static Debug* pInstance;
bool enabled;
protected:
/**
* constructor
*/
Debug() {
setEnabled(false);
}
/**
* destructor
*/
~Debug() {
if(pInstance != 0) delete pInstance;
}
public:
/**
* return static instance of this class
*/
static Debug* Inst() {
if(pInstance == 0) pInstance = new Debug();
return pInstance;
}
/**
* change status of enabled bit. Default is false
*/
void setEnabled(bool e = false) {
enabled = e;
}
/**
* get status of enable bit
*/
bool getEnabled() {
return enabled;
}
/**
* print the tkCommissioner logo
*/
void printLogo() {
const char* sdebug= "DEBUG MODE";
if(!Debug::Inst()->getEnabled()) sdebug = " ";
qDebug() << "\n"
<< " \e[1;30m********************************************************************\e[0m\n"
<< " \e[1;30m*\e[0m \e[1;30m _ _ ___ _ _ \e[0m\e[1;30m*\e[0m\n"
<< " \e[1;30m*\e[0m \e[1;34m| |_| |__/ __|___ _ __ _ __ (_)_____(_)___ _ _ ___ _ _ \e[0m\e[1;30m*\e[0m\n"
<< " \e[1;30m*\e[0m \e[1;34m| _| / / (__/ _ \\ ' \\| ' \\| (_-<_-< / _ \\ ' \\/ -_) '_| \e[0m\e[1;30m*\e[0m\n"
<< " \e[1;30m*\e[0m \e[1;34m \\__|_\\_\\\\___\\___/_|_|_|_|_|_|_/__/__/_\\___/_||_\\___|_| \e[0m\e[1;30m*\e[0m\n"
<< " \e[1;30m*\e[0m \e[1;30m*\e[0m\n"
<< " \e[1;30m*\e[0m (tkCommissioner) \e[1;30m*\e[0m\n"
<< " * " << sdebug << " *\n"
<< " \e[1;30m*\e[0m \e[1;30m*\e[0m\n"
<< " \e[1;30m*\e[0m In case of problems have a look at: \e[1;30m*\e[0m\n"
<< " \e[1;30m*\e[0m https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideTkCommissioner \e[1;30m*\e[0m\n"
<< " \e[1;30m*\e[0m \e[1;30m*\e[0m\n"
<< " \e[1;30m********************************************************************\e[0m\n";
}
};
#endif