本文整理汇总了Python中neubot.log.LOG.log_access方法的典型用法代码示例。如果您正苦于以下问题:Python LOG.log_access方法的具体用法?Python LOG.log_access怎么用?Python LOG.log_access使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neubot.log.LOG
的用法示例。
在下文中一共展示了LOG.log_access方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send_response
# 需要导入模块: from neubot.log import LOG [as 别名]
# 或者: from neubot.log.LOG import log_access [as 别名]
def send_response(self, request, response):
''' Send a response to the client '''
if self.response_rewriter:
self.response_rewriter(request, response)
if request['connection'] == 'close' or request.protocol == 'HTTP/1.0':
response['connection'] = 'close'
self.send_message(response)
if response['connection'] == 'close':
self.close()
address = self.peername[0]
now = time.gmtime()
timestring = "%02d/%s/%04d:%02d:%02d:%02d -0000" % (now.tm_mday,
MONTH[now.tm_mon], now.tm_year, now.tm_hour, now.tm_min, now.tm_sec)
requestline = request.requestline
statuscode = response.code
nbytes = "-"
if response["content-length"]:
nbytes = response["content-length"]
if nbytes == "0":
nbytes = "-"
LOG.log_access("%s - - [%s] \"%s\" %s %s" % (address, timestring,
requestline, statuscode,
nbytes))
示例2: send_response
# 需要导入模块: from neubot.log import LOG [as 别名]
# 或者: from neubot.log.LOG import log_access [as 别名]
def send_response(self, request, response):
self.send_message(response)
address = self.peername[0]
now = time.gmtime()
timestring = "%02d/%s/%04d:%02d:%02d:%02d -0000" % (now.tm_mday,
MONTH[now.tm_mon], now.tm_year, now.tm_hour, now.tm_min, now.tm_sec)
requestline = request.requestline
statuscode = response.code
nbytes = "-"
if response["content-length"]:
nbytes = response["content-length"]
if nbytes == "0":
nbytes = "-"
LOG.log_access("%s - - [%s] \"%s\" %s %s" % (address, timestring,
requestline, statuscode,
nbytes))