consolelogger.py
672 Bytes
import datetime
from logsystem import LogSystem
BASH_YLW_TEXT = '\033[33m'
BASH_RED_TEXT = '\033[31m'
BASH_RESET_TEXT = '\033[0m'
class ConsoleLogger(LogSystem):
def writeLog(self,message,module,type = None):
if(type == None):
type = self.TYPE_INFO
time = str(datetime.datetime.now())
if(type == self.TYPE_ERROR):
print(time + " [" + module + "] " + BASH_RED_TEXT + "ERROR: " + message + BASH_RESET_TEXT)
elif(type == self.TYPE_WARNING):
print(time + " [" + module + "] " + BASH_YLW_TEXT + "WARNING: " + message + BASH_RESET_TEXT)
elif(type == self.TYPE_INFO):
print(time + " [" + module + "] " + "INFO: " + message)
else:
print(message)