mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Merge pull request #1291 from lyft/add-environ-variables-to-logger
Add environment variables to gunicorn access log format
This commit is contained in:
commit
ac708f5e44
@ -1091,9 +1091,9 @@ class AccessLogFormat(Setting):
|
|||||||
desc = """\
|
desc = """\
|
||||||
The access log format.
|
The access log format.
|
||||||
|
|
||||||
========== ===========
|
=========== ===========
|
||||||
Identifier Description
|
Identifier Description
|
||||||
========== ===========
|
=========== ===========
|
||||||
h remote address
|
h remote address
|
||||||
l ``'-'``
|
l ``'-'``
|
||||||
u user name
|
u user name
|
||||||
@ -1114,7 +1114,8 @@ class AccessLogFormat(Setting):
|
|||||||
p process ID
|
p process ID
|
||||||
{Header}i request header
|
{Header}i request header
|
||||||
{Header}o response header
|
{Header}o response header
|
||||||
========== ===========
|
{Variable}e environment variable
|
||||||
|
=========== ===========
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -303,6 +303,10 @@ class Logger(object):
|
|||||||
# add response headers
|
# add response headers
|
||||||
atoms.update(dict([("{%s}o" % k.lower(), v) for k, v in resp_headers]))
|
atoms.update(dict([("{%s}o" % k.lower(), v) for k, v in resp_headers]))
|
||||||
|
|
||||||
|
# add environ variables
|
||||||
|
environ_variables = environ.items()
|
||||||
|
atoms.update(dict([("{%s}e" % k.lower(), v) for k, v in environ_variables]))
|
||||||
|
|
||||||
return atoms
|
return atoms
|
||||||
|
|
||||||
def access(self, resp, req, environ, request_time):
|
def access(self, resp, req, environ, request_time):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user