change structure

This commit is contained in:
chrys87 2016-07-08 12:20:49 +02:00 committed by GitHub
parent 8980148dab
commit ac3919b86d

View File

@ -2,13 +2,14 @@
# Debugger module for the Fenrir screen reader. # Debugger module for the Fenrir screen reader.
DEACTIVE = 0 class debugLevel(Enum):
ERROR = 1 DEACTIVE = 0
WARNING = 2 ERROR = 1
INFO = 3 WARNING = 2
INFO = 3
class debug(): class debug():
def __init__(self, fileName='/var/log/fenrir.log', level = DEACTIVE): def __init__(self, fileName='/var/log/fenrir.log', level = debugLevel.DEACTIVE):
self._level = level self._level = level
self._fileName = fileName self._fileName = fileName
self._file = '' self._file = ''
@ -22,7 +23,7 @@ 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, level = DEACTIVE): def writeDebugOut(self, envirionment, text, level = debugLevel.DEACTIVE):
if envirionment['settings']['debugLevel'] < level: if envirionment['settings']['debugLevel'] < level:
if self._fileOpened: if self._fileOpened:
self.closeDebugFile() self.closeDebugFile()