mirror of
https://github.com/KevinMidboe/transatlanticTorrentExpress.git
synced 2025-10-29 18:00:19 +00:00
Fixed issue where not supplying es argument to logger threw an error.
This commit is contained in:
@@ -43,7 +43,7 @@ class ESHandler(logging.Handler):
|
|||||||
'sessionID': str(self.sessionID)
|
'sessionID': str(self.sessionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
if record.es:
|
if hasattr(record, 'es'):
|
||||||
for param in record.es.values():
|
for param in record.es.values():
|
||||||
if ': {}'.format(param) in record.message:
|
if ': {}'.format(param) in record.message:
|
||||||
doc['message'] = record.message.replace(': {}'.format(str(param)), '')
|
doc['message'] = record.message.replace(': {}'.format(str(param)), '')
|
||||||
@@ -62,6 +62,8 @@ class ElasticFieldParameterAdapter(logging.LoggerAdapter):
|
|||||||
super().__init__(logger, extra)
|
super().__init__(logger, extra)
|
||||||
|
|
||||||
def process(self, msg, kwargs):
|
def process(self, msg, kwargs):
|
||||||
|
if kwargs == {}:
|
||||||
|
return (msg, kwargs)
|
||||||
extra = kwargs.get("extra", {})
|
extra = kwargs.get("extra", {})
|
||||||
extra.update({"es": kwargs.pop("es", True)})
|
extra.update({"es": kwargs.pop("es", True)})
|
||||||
kwargs["extra"] = extra
|
kwargs["extra"] = extra
|
||||||
|
|||||||
Reference in New Issue
Block a user