From 8eba976ff9a7d24db072fdd6a2715d3f063cab2e Mon Sep 17 00:00:00 2001 From: Sergei Shishov Date: Wed, 28 Aug 2019 11:02:48 +0400 Subject: [PATCH] Add ability to override name in log record NOTE: documentation should be updated accordingly --- cid/log.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cid/log.py b/cid/log.py index 33fca16..9ea36b1 100644 --- a/cid/log.py +++ b/cid/log.py @@ -1,10 +1,12 @@ import logging +from django.conf import settings + from cid.locals import get_cid class CidContextFilter(logging.Filter): def filter(self, record): - record.cid = get_cid() + setattr(record, getattr(settings, 'CID_LOG_RECORD_NAME', 'cid'), get_cid()) return True