Skip to content

Commit bc22887

Browse files
committed
fix variable name: it's micro seconds (us) not milli seconds (ms)
1 parent 30b7426 commit bc22887

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

requestlogger/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def custom_start_response(status, response_headers, exc_info=None):
5252
retval = self.application(environ, custom_start_response)
5353
runtime = int((clock() - start) * 10**6)
5454
content_length = content_lengths[0] if content_lengths else len(b''.join(retval))
55-
msg = self.formatter(status_codes[0], environ, content_length, rt_ms=runtime)
55+
msg = self.formatter(status_codes[0], environ, content_length, rt_us=runtime)
5656
self.logger.info(msg)
5757
return retval
5858

@@ -104,12 +104,12 @@ def format_NCSA_log(status_code, environ, content_length, **kwargs):
104104
@staticmethod
105105
def format_with_response_time(*args, **kw):
106106
"""
107-
The dict kw should contain 'rt_ms', the response time in milliseconds.
107+
The dict kw should contain 'rt_us', the response time in milliseconds.
108108
This is the format for TinyLogAnalyzer:
109109
https://pypi.python.org/pypi/TinyLogAnalyzer
110110
"""
111-
rt_ms = kw.get('rt_ms')
112-
return ApacheFormatters.format_NCSA_log(*args) + " {0}/{1}".format(int(rt_ms/1000000), rt_ms)
111+
rt_us = kw.get('rt_us')
112+
return ApacheFormatters.format_NCSA_log(*args) + " {0}/{1}".format(int(rt_us/1000000), rt_us)
113113

114114

115115
def log(handlers, formatter=ApacheFormatter(), **kw):

0 commit comments

Comments
 (0)