-
Notifications
You must be signed in to change notification settings - Fork 0
/
logPrint.py
49 lines (38 loc) · 1.13 KB
/
logPrint.py
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
# -*-coding:Latin-1 -*
class logPrint:
# Debug level :
# 0 : debug
# 1 : log
# 2 : error and informations
logLevel = 2
def __init__(self, debugLevel=2):
if (debugLevel >= 0 and debugLevel <= 2):
logPrint.logLevel = debugLevel
else:
logPrint.printError(
"[ERR] debugLevel has not a correct value, "+debugLevel)
pass
def printDebug(cls, value):
if (logPrint.logLevel == 0):
print("[DBG] "+value)
else:
pass
printDebug = classmethod(printDebug)
def printLog(cls, value):
if (logPrint.logLevel <= 1):
print("[LOG] "+value)
else:
pass
printLog = classmethod(printLog)
def printError(cls, value):
if (logPrint.logLevel <= 2):
print("[ERR] "+value)
else:
pass
printError = classmethod(printError)
def printInfo(cls, value):
if (logPrint.logLevel <= 2):
print("[INF] "+value)
else:
pass
printInfo = classmethod(printInfo)