We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c8193f8 commit 301bc51Copy full SHA for 301bc51
boxmot/utils/__init__.py
@@ -6,6 +6,7 @@
6
from pathlib import Path
7
8
import numpy as np
9
+import multiprocessing as mp
10
11
# global logger
12
from loguru import logger
@@ -23,7 +24,17 @@
23
24
25
NUM_THREADS = min(8, max(1, os.cpu_count() - 1))
26
-
27
-def only_main_thread(record):
28
- # Check if the current thread is the main thread
29
- return threading.current_thread().name == "MainThread"
+def _is_main_process(record):
+ return mp.current_process().name == "MainProcess"
+
30
+def configure_logging():
31
+ # this will remove *all* existing handlers and then add yours
32
+ logger.configure(handlers=[
33
+ {
34
+ "sink": sys.stderr,
35
+ "level": "INFO",
36
+ "filter": _is_main_process,
37
+ }
38
+ ])
39
40
+configure_logging()
0 commit comments