-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogger.py
More file actions
24 lines (18 loc) · 890 Bytes
/
logger.py
File metadata and controls
24 lines (18 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import datetime
import colorama
class Logger:
def __init__(self, departmentName, writeToLoggerFile=False) -> None:
self.departmentName = departmentName
self.writeToLoggerFile = writeToLoggerFile
self.info = "INFO",
self.warning = "WARNING",
self.error = "ERROR",
self.debug = "DEBUG",
def __printOut(self, message, level, color=colorama.Fore.WHITE):
print(f"{color}[{datetime.datetime.today()}][{level}][{self.departmentName}] : {message}")
def printinfo(self, message, color=colorama.Fore.WHITE):
self.__printOut(message, self.info, color)
def printwarning(self, message, color=colorama.Fore.YELLOW):
self.__printOut(message, self.warning, color)
def printerror(self, message, color=colorama.Fore.RED):
self.__printOut(message, self.error, color)