mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-15 15:45:27 +03:00
Give each util.Process their own logger
This will help to reduce boilerplate in subclasses.
This commit is contained in:
parent
9792136950
commit
70d732ad36
@ -49,6 +49,8 @@ class BaseProcess(mp.Process):
|
|||||||
|
|
||||||
|
|
||||||
class Process(BaseProcess):
|
class Process(BaseProcess):
|
||||||
|
logger: logging.Logger
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def stop_event(self) -> threading.Event:
|
def stop_event(self) -> threading.Event:
|
||||||
# Lazily create the stop_event. This allows the signal handler to tell if anyone is
|
# 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.SIGTERM, receiveSignal)
|
||||||
signal.signal(signal.SIGINT, receiveSignal)
|
signal.signal(signal.SIGINT, receiveSignal)
|
||||||
|
|
||||||
|
self.logger = logging.getLogger(self.name)
|
||||||
|
|
||||||
if self.__log_queue:
|
if self.__log_queue:
|
||||||
logging.basicConfig(handlers=[], force=True)
|
logging.basicConfig(handlers=[], force=True)
|
||||||
logging.getLogger().addHandler(QueueHandler(self.__log_queue))
|
logging.getLogger().addHandler(QueueHandler(self.__log_queue))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user