Update debug.py

This commit is contained in:
chrys87 2016-09-15 12:03:55 +02:00 committed by GitHub
parent 1cc8bc4ddf
commit ff18278921

View File

@ -2,6 +2,7 @@
# Debugger module for the Fenrir screen reader. # Debugger module for the Fenrir screen reader.
from enum import Enum from enum import Enum
import time
class debugLevel(Enum): class debugLevel(Enum):
DEACTIVE = 0 DEACTIVE = 0
@ -10,6 +11,8 @@ class debugLevel(Enum):
INFO = 3 INFO = 3
def __int__(self): def __int__(self):
return self.value return self.value
def __str__(self):
return self.name
class debug(): class debug():
def __init__(self, fileName='/var/log/fenrir.log'): def __init__(self, fileName='/var/log/fenrir.log'):
@ -39,7 +42,7 @@ class debug():
else: else:
if not self._fileOpened: if not self._fileOpened:
self.openDebugFile() self.openDebugFile()
self._file.write(text + '\n') self._file.write(str(level) +': ' + str(time.time()) + ' ' + text + '\n')
def closeDebugFile(self): def closeDebugFile(self):
if not self._fileOpened: if not self._fileOpened: