本文整理汇总了Python中gunicorn.glogging.Logger.access方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.access方法的具体用法?Python Logger.access怎么用?Python Logger.access使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gunicorn.glogging.Logger
的用法示例。
在下文中一共展示了Logger.access方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: access
# 需要导入模块: from gunicorn.glogging import Logger [as 别名]
# 或者: from gunicorn.glogging.Logger import access [as 别名]
def access(self, resp, req, environ, request_time):
# health check endpoints are only logged in debug mode
if (
not os.environ.get('DEIS_DEBUG', False) and
req.path in ['/readiness', '/healthz']
):
return
Logger.access(self, resp, req, environ, request_time)
示例2: access
# 需要导入模块: from gunicorn.glogging import Logger [as 别名]
# 或者: from gunicorn.glogging.Logger import access [as 别名]
def access(self, resp, req, environ, request_time):
"""Measure request duration
request_time is a datetime.timedelta
"""
Logger.access(self, resp, req, environ, request_time)
duration_in_ms = request_time.seconds * 1000 + float(request_time.microseconds) / 10 ** 3
self.histogram("gunicorn.request.duration", duration_in_ms)
self.increment("gunicorn.requests", 1)
self.increment("gunicorn.request.status.%d" % int(resp.status.split()[0]), 1)