You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Change access log atom %({...}e)s to read ASGI scope #359
But {...}e, the "environment variable" atom, is very different:
In Hypercorn, it reads Operating System environment variables (os.environ).
In Gunicorn, it reads WSGI environment variables (the WSGI environ dict).
I suspect you misunderstood the Gunicorn docs when you implemented it...
The cool thing about Gunicorn's version is that the WSGI app itself, while it's running, can add more info to the WSGI environ. This info can then become part of the access log line. For example, you could log some app-specific Trace ID, user/auth info, or some details about the response beyond just HTTP status code.
My feature request is that {...}e in Hypercorn should read from ASGI scope. If scope["myapp.foo"] has type str or bytes, then %({myapp.foo}e)s should log it.
This would match Gunicorn more closely, and is more useful than reading OS environment variables (they're effectively constant for all requests). Alternatively, if you don't want to make a breaking change, and you don't care about consistency with Gunicorn, then adding a new atom for ASGI scope variables would work too.
Activity