change structure

This commit is contained in:
chrys87 2016-07-08 12:06:09 +02:00 committed by GitHub
parent e86cd8326f
commit d9ef1dc567

View File

@ -22,21 +22,21 @@ class debug():
self.file = open(self._fileName,'w')
self._fileOpened = True
def writeDebugOut(self, envirionment, text):
if not envirionment['generalInformation']['debugEnabled']:
def writeDebugOut(self, envirionment, text, level=ERROR):
if envirionment['generalInformation']['debugLevel']:
if self._fileOpened:
self.closeDebugFile()
return
else:
if not self._fileOpened:
self.openDebugFile()
self.writeLog(environment, text):
self.writeLog(environment, text, level):
def writeLog(self, environment, text):
if not self._fileOpened:
return False
def writeLog(self, environment, text, level:
if self._level < envirionment['generalInformation']['debugLevel']:
return False
if not self._fileOpened:
return False
self._file.write(text + '\n')
return True