Skip to content

Commit

Permalink
Merge pull request ipython#5097 from minrk/logging-some-more
Browse files Browse the repository at this point in the history
minor notebook logging changes
  • Loading branch information
takluyver committed Feb 14, 2014
2 parents 8f44f2c + fd034a0 commit c6e57a3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions IPython/html/log.py
Expand Up @@ -37,14 +37,10 @@ def log_request(handler):
request_time=request_time,
)
msg = "{status} {method} {uri} ({ip}) {request_time:.2f}ms"
if status >= 300:
# log referers on redirects
if status >= 400:
# log bad referers
ns['referer'] = request.headers.get('Referer', 'None')
msg = msg + ' referer={referer}'
if status >= 400:
# log user agent for failed requests
ns['agent'] = request.headers.get('User-Agent', 'Unknown')
msg = msg + ' user-agent={agent}'
if status >= 500 and status != 502:
# log all headers if it caused an error
log_method(json.dumps(request.headers, indent=2))
Expand Down

0 comments on commit c6e57a3

Please sign in to comment.