我目前正在使用 python structlog JSONRenderer 并希望更改我的日志配置以将事件呈现为第一个 JSON 属性以获得更好的可读性。
当前配置:
structlog.configure(processors=[structlog.processors.JSONRenderer()])
log = structlog.get_logger()
当前日志调用站点:
log.msg("Response: ",
content_type=content_type,
content_length=resp.headers.get('content-length'),
status_code=resp.status_code
)
电流输出:
{"content_type": "application/json", "content_length": null, "status_code": 200, "event": "Response: "}
期望的输出:
{"event": "Response: ", "content_type": "application/json", "content_length": null, "status_code": 200}
任何帮助将不胜感激。