ignore error if request.ip is None
This commit is contained in:
parent
7a3f9daccf
commit
f50a37fc88
|
@ -312,13 +312,15 @@ class HttpProtocol(asyncio.Protocol):
|
||||||
else:
|
else:
|
||||||
extra['byte'] = -1
|
extra['byte'] = -1
|
||||||
|
|
||||||
|
extra['host'] = 'UNKNOWN'
|
||||||
if self.request is not None:
|
if self.request is not None:
|
||||||
extra['host'] = '{0}:{1}'.format(self.request.ip[0],
|
if self.request.ip:
|
||||||
self.request.ip[1])
|
extra['host'] = '{0}:{1}'.format(self.request.ip[0],
|
||||||
|
self.request.ip[1])
|
||||||
|
|
||||||
extra['request'] = '{0} {1}'.format(self.request.method,
|
extra['request'] = '{0} {1}'.format(self.request.method,
|
||||||
self.request.url)
|
self.request.url)
|
||||||
else:
|
else:
|
||||||
extra['host'] = 'UNKNOWN'
|
|
||||||
extra['request'] = 'nil'
|
extra['request'] = 'nil'
|
||||||
|
|
||||||
access_logger.info('', extra=extra)
|
access_logger.info('', extra=extra)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user