mirror of
https://github.com/sprockets/sprockets.http.git
synced 2024-11-14 11:19:26 +00:00
Add reason to acccess log
This commit is contained in:
parent
0c446ca73c
commit
0ff358a67e
2 changed files with 5 additions and 3 deletions
|
@ -242,7 +242,7 @@ class Application(CallbackManager, web.Application):
|
|||
|
||||
log.access_log.log(
|
||||
log_level,
|
||||
'%s %s %s [%s] "%s %s %s" %d %s "%s" "%s" (secs:%.03f)',
|
||||
'%s %s %s [%s] "%s %s %s" %d "%s" %s "%s" "%s" (secs:%.03f)',
|
||||
handler.request.remote_ip,
|
||||
'-', # RFC-1413 user identifier
|
||||
handler.get_current_user() or '-',
|
||||
|
@ -251,6 +251,7 @@ class Application(CallbackManager, web.Application):
|
|||
handler.request.uri,
|
||||
handler.request.version,
|
||||
status,
|
||||
handler._reason or '-',
|
||||
bytes_written,
|
||||
handler.request.headers.get('Referer', '-'),
|
||||
handler.request.headers.get('User-Agent', '-'),
|
||||
|
|
5
tests.py
5
tests.py
|
@ -814,11 +814,12 @@ class AccessLogTests(sprockets.http.testing.SprocketsHttpTestCase):
|
|||
when = datetime.datetime.fromtimestamp(request._start_time,
|
||||
datetime.timezone.utc)
|
||||
expected_message = re.compile(
|
||||
r'^%s - - %s "%s %s %s" %d - "-" "-" \(secs:([^)]*)\)' %
|
||||
r'^%s - - %s "%s %s %s" %d "%s" - "-" "-" \(secs:([^)]*)\)' %
|
||||
(request.remote_ip,
|
||||
re.escape(
|
||||
when.strftime('[%d/%b/%Y:%H:%M:%S %z]')), request.method,
|
||||
re.escape(request.uri), request.version, handler.get_status()))
|
||||
re.escape(request.uri), request.version, handler.get_status(),
|
||||
handler._reason))
|
||||
message = context.records[0].getMessage()
|
||||
match = expected_message.match(message)
|
||||
if match is None:
|
||||
|
|
Loading…
Reference in a new issue