paperless-ngx/src/documents/loggers.py

19 lines
475 B
Python
Raw Normal View History

2016-02-27 20:18:50 +00:00
import logging
import uuid
2016-02-27 20:18:50 +00:00
class LoggingMixin:
def __init__(self) -> None:
self.renew_logging_group()
2021-02-05 01:10:29 +01:00
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},
)