From 70d732ad367db9fdc534c59efed1e66ed9d262f6 Mon Sep 17 00:00:00 2001 From: George Tsiamasiotis Date: Thu, 3 Oct 2024 19:19:42 +0300 Subject: [PATCH] Give each util.Process their own logger This will help to reduce boilerplate in subclasses. --- frigate/util/process.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frigate/util/process.py b/frigate/util/process.py index 8ef588b99..23e484b23 100644 --- a/frigate/util/process.py +++ b/frigate/util/process.py @@ -49,6 +49,8 @@ class BaseProcess(mp.Process): class Process(BaseProcess): + logger: logging.Logger + @property def stop_event(self) -> threading.Event: # Lazily create the stop_event. This allows the signal handler to tell if anyone is @@ -74,6 +76,8 @@ class Process(BaseProcess): signal.signal(signal.SIGTERM, receiveSignal) signal.signal(signal.SIGINT, receiveSignal) + self.logger = logging.getLogger(self.name) + if self.__log_queue: logging.basicConfig(handlers=[], force=True) logging.getLogger().addHandler(QueueHandler(self.__log_queue))