Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix formatting
Browse files Browse the repository at this point in the history
urbaniak committed Jan 28, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 7d8d3da commit 7875dd9
Showing 2 changed files with 9 additions and 13 deletions.
14 changes: 6 additions & 8 deletions gunicorn/glogging.py
Original file line number Diff line number Diff line change
@@ -237,10 +237,9 @@ def log(self, lvl, msg, *args, **kwargs):
def atoms(self, resp, req, environ, request_time):
""" Gets atoms for log formating.
"""
if type(resp.status) is int:
status = resp.status
else:
status = resp.status.split(None, 1)[0]
status = resp.status
if isinstance(status, str):
status = status.split(None, 1)[0]
atoms = {
'h': environ.get('REMOTE_ADDR', '-'),
'l': '-',
@@ -274,10 +273,9 @@ def atoms(self, resp, req, environ, request_time):

atoms.update(dict([("{%s}i" % k.lower(), v) for k, v in req_headers]))

if hasattr(resp.headers, "items"):
resp_headers = resp.headers.items()
else:
resp_headers = resp.headers
resp_headers = resp.headers
if hasattr(resp_headers, "items"):
resp_headers = resp_headers.items()

# add response headers
atoms.update(dict([("{%s}o" % k.lower(), v) for k, v in resp_headers]))
8 changes: 3 additions & 5 deletions gunicorn/instrument/statsd.py
Original file line number Diff line number Diff line change
@@ -93,11 +93,9 @@ def access(self, resp, req, environ, request_time):
"""
Logger.access(self, resp, req, environ, request_time)
duration_in_ms = request_time.seconds * 1000 + float(request_time.microseconds) / 10 ** 3
if type(resp.status) is int:
status = resp.status
else:
status = int(resp.status.split()[0])

status = resp.status
if isinstance(status, str):
status = status.split(None, 1)[0]
self.histogram("gunicorn.request.duration", duration_in_ms)
self.increment("gunicorn.requests", 1)
self.increment("gunicorn.request.status.%d" % status, 1)

0 comments on commit 7875dd9

Please sign in to comment.