some changes

This commit is contained in:
Wolfgang Hottgenroth
2016-10-31 16:27:39 +01:00
parent ebb18e3d66
commit 6d415e481c
4 changed files with 16 additions and 5 deletions

View File

@ -2,13 +2,14 @@ from time import gmtime, strftime
class Logger(object):
debugFlag = False
debugToStdoutFlag = False
@classmethod
def log(cls, data):
t = strftime("%d %b %Y %H:%M:%S", gmtime())
with open(cls.logfile, 'a') as f:
f.write("%s %s\n" % (t, data))
if cls.debugFlag:
if cls.debugFlag and cls.debugToStdoutFlag:
print data
@classmethod
@ -20,6 +21,10 @@ class Logger(object):
def debugEnable(cls):
cls.debugFlag = True
@classmethod
def debugToStdoutEnable(cls):
cls.debugToStdoutFlag = True
@classmethod
def debugDisable(cls):
cls.debugFlag = False