Minor improvement to logging output
This commit is contained in:
parent
072047390b
commit
2d4760f5ed
1 changed files with 13 additions and 4 deletions
|
@ -1,9 +1,18 @@
|
|||
import logging
|
||||
import threading
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class Logger:
|
||||
def debug(self, message):
|
||||
print(message)
|
||||
@staticmethod
|
||||
def _format(message: str, severity: str) -> str:
|
||||
thread = threading.current_thread().name
|
||||
datestr = str(datetime.now())
|
||||
return f"{datestr} - {thread} - {severity} - {message}"
|
||||
|
||||
def info(self, message):
|
||||
print(message)
|
||||
def debug(self, message: str) -> None:
|
||||
print(self.__class__()._format(message, "DEBUG"))
|
||||
|
||||
def info(self, message: str) -> None:
|
||||
print(self.__class__()._format(message, "INFO"))
|
Loading…
Reference in a new issue