[+] multiprocessing support
This commit is contained in:
parent
e71d2f1a87
commit
1e4a7c23d1
@ -1,4 +1,5 @@
|
||||
import glob
|
||||
import multiprocessing
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
@ -28,6 +29,8 @@ log_file = log_dir / "info.log"
|
||||
os.makedirs(log_dir, exist_ok=True)
|
||||
|
||||
def zip_logs():
|
||||
if multiprocessing.current_process().name != "MainProcess":
|
||||
return
|
||||
try:
|
||||
if os.path.exists(log_file):
|
||||
ftime = os.path.getmtime(log_file)
|
||||
@ -61,4 +64,7 @@ def setup(console_debug=False, file_debug=False, file_low_debug=False, module_se
|
||||
logger.add(log_dir / "low_debug.log", level=0, rotation="10 MB")
|
||||
sys.excepthook = handle_exception
|
||||
threading.excepthook = handle_thread_exception
|
||||
if multiprocessing.current_process().name != "MainProcess":
|
||||
logger.bind(module="subproc", prefix="init").debug(f"Process id: {multiprocessing.current_process().pid} Started in {multiprocessing.current_process().name}")
|
||||
else:
|
||||
logger.bind(module="LoggerSetup", prefix="init").success("Logger initialized.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user