paperless-ngx/src/documents/loggers.py

16 lines
407 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 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},
)