MCPcopy Create free account
hub / github.com/EasyIME/PIME / log_request

Method log_request

python/python3/tornado/web.py:2253–2276  ·  view source on GitHub ↗

Writes a completed HTTP request to the logs. By default writes to the python root logger. To change this behavior either subclass Application and override this method, or pass a function in the application settings dictionary as ``log_function``.

(self, handler: RequestHandler)

Source from the content-addressed store, hash-verified

2251 raise KeyError("%s not found in named urls" % name)
2252
2253 def log_request(self, handler: RequestHandler) -> None:
2254 """Writes a completed HTTP request to the logs.
2255
2256 By default writes to the python root logger. To change
2257 this behavior either subclass Application and override this method,
2258 or pass a function in the application settings dictionary as
2259 ``log_function``.
2260 """
2261 if "log_function" in self.settings:
2262 self.settings["log_function"](handler)
2263 return
2264 if handler.get_status() < 400:
2265 log_method = access_log.info
2266 elif handler.get_status() < 500:
2267 log_method = access_log.warning
2268 else:
2269 log_method = access_log.error
2270 request_time = 1000.0 * handler.request.request_time()
2271 log_method(
2272 "%d %s %.2fms",
2273 handler.get_status(),
2274 handler._request_summary(),
2275 request_time,
2276 )
2277
2278
2279class _HandlerDelegate(httputil.HTTPMessageDelegate):

Callers 1

_logMethod · 0.80

Calls 3

get_statusMethod · 0.80
request_timeMethod · 0.80
_request_summaryMethod · 0.80

Tested by

no test coverage detected