mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
19 lines
475 B
Python
19 lines
475 B
Python
import logging
|
|
import uuid
|
|
|
|
|
|
class LoggingMixin:
|
|
def __init__(self) -> None:
|
|
self.renew_logging_group()
|
|
|
|
def renew_logging_group(self):
|
|
"""
|
|
Creates a new UUID to group subsequent log calls together with
|
|
the extra data named group
|
|
"""
|
|
self.logging_group = uuid.uuid4()
|
|
self.log = logging.LoggerAdapter(
|
|
logging.getLogger(self.logging_name),
|
|
extra={"group": self.logging_group},
|
|
)
|