fully implemented project
This commit is contained in:
18
app/logger.py
Normal file
18
app/logger.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import sys
|
||||
import threading
|
||||
|
||||
_console_lock = threading.Lock()
|
||||
|
||||
def _log(prefix: str, message: str):
|
||||
with _console_lock:
|
||||
print(prefix + ": " + message)
|
||||
|
||||
def info(message: str):
|
||||
_log("INFO", message)
|
||||
|
||||
def warning(message: str):
|
||||
_log("WARNING", message)
|
||||
|
||||
def error(message: str):
|
||||
_log("ERROR", message)
|
||||
sys.exit(1)
|
||||
Reference in New Issue
Block a user