From 6945e1bb395fce4933e016b787ea1285a97d3701 Mon Sep 17 00:00:00 2001 From: Elouan Martinet Date: Sat, 5 Nov 2022 00:12:18 +0100 Subject: [PATCH] improve: convert unserializable attributes to str in JSON serializer --- json_logging/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json_logging/__init__.py b/json_logging/__init__.py index ce4571d..24894a2 100644 --- a/json_logging/__init__.py +++ b/json_logging/__init__.py @@ -20,7 +20,7 @@ ENABLE_JSON_LOGGING_DEBUG = False EMPTY_VALUE = '-' CREATE_CORRELATION_ID_IF_NOT_EXISTS = True -JSON_SERIALIZER = lambda log: json.dumps(log, ensure_ascii=False) +JSON_SERIALIZER = lambda log: json.dumps(log, ensure_ascii=False, default=str) CORRELATION_ID_HEADERS = ['X-Correlation-ID', 'X-Request-ID'] COMPONENT_ID = EMPTY_VALUE COMPONENT_NAME = EMPTY_VALUE