Access Logging with value from custom header AND optionally response #1615
Unanswered
ssproessig-thales
asked this question in
Q&A
Replies: 2 comments 2 replies
-
We should aim to improve the documentation on that, but for now: https://github.com/Kludex/asgi-logger |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hi, did anything ever come from that? E.g., on how to include header information like |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I have two questions regarding the access logging
1. adding more information from headers
currently, my log looks like this:
I'd like to add some decoded information from a header (namely the user part of
Basic
authentication in theAuthorization
header) so that it looks likefrom the HTTP header
so at best by invoking a callback that performs base64 decoding and only returns the user part, not the password part. Hence I don't want the raw header to be logged.
Can this be done with uvicorn?
2. conditionally log the request / response body
when my API encounters 409 or 422 responses, it would really be helpful to have the request and response body as part of the
DEBUG
log. Currently I have to implement this as per endpoint, which is repetitive and surely is forgotten at some endpoints.Can this be configured directly in uvicorn?
Beta Was this translation helpful? Give feedback.
All reactions