-
Notifications
You must be signed in to change notification settings - Fork 32
Closed
Labels
Milestone
Description
Right now when you add an object to your log like this:
logger.info(
"request_started",
request=request,
user_agent=request.META.get("HTTP_USER_AGENT"),
)You end up with TypeError like this: <WSGIRequest: GET '/healthcheck/'> is not JSON serializable in json_dumps (ecs_logging/_utils.py):
if value:
return "{%s,%s" % (
ordered_json,
json.dumps(value, sort_keys=True, separators=(",", ":"))[1:],
)You should use a default argument for json.dumps and provide fallback mechanism to handle this situation. See https://www.structlog.org/en/stable/_modules/structlog/processors.html#JSONRenderer and _json_fallback_handler.