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.file = open(self._fileName,'w')
self._fileOpened = True self._fileOpened = True
def writeDebugOut(self, envirionment, text): def writeDebugOut(self, envirionment, text, level=ERROR):
if not envirionment['generalInformation']['debugEnabled']: if envirionment['generalInformation']['debugLevel']:
if self._fileOpened: if self._fileOpened:
self.closeDebugFile() self.closeDebugFile()
return return
else: else:
if not self._fileOpened: if not self._fileOpened:
self.openDebugFile() self.openDebugFile()
self.writeLog(environment, text): self.writeLog(environment, text, level):
def writeLog(self, environment, text): def writeLog(self, environment, text, level:
if not self._fileOpened:
return False
if self._level < envirionment['generalInformation']['debugLevel']: if self._level < envirionment['generalInformation']['debugLevel']:
return False return False
if not self._fileOpened:
return False
self._file.write(text + '\n') self._file.write(text + '\n')
return True return True