mirror of
https://github.com/GNS3/gns3-server
synced 2025-02-17 18:42:00 +00:00
Fix log with recent aiohttp versions
This commit is contained in:
parent
e097a0e728
commit
34459f6a88
@ -18,6 +18,7 @@
|
|||||||
import json
|
import json
|
||||||
import jsonschema
|
import jsonschema
|
||||||
import aiohttp.web
|
import aiohttp.web
|
||||||
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
import jinja2
|
import jinja2
|
||||||
@ -41,7 +42,8 @@ class Response(aiohttp.web.Response):
|
|||||||
headers['Server'] = "Python/{0[0]}.{0[1]} GNS3/{1}".format(sys.version_info, __version__)
|
headers['Server'] = "Python/{0[0]}.{0[1]} GNS3/{1}".format(sys.version_info, __version__)
|
||||||
super().__init__(headers=headers, **kwargs)
|
super().__init__(headers=headers, **kwargs)
|
||||||
|
|
||||||
def start(self, request):
|
@asyncio.coroutine
|
||||||
|
def prepare(self, request):
|
||||||
if log.getEffectiveLevel() == logging.DEBUG:
|
if log.getEffectiveLevel() == logging.DEBUG:
|
||||||
log.info("%s %s", request.method, request.path_qs)
|
log.info("%s %s", request.method, request.path_qs)
|
||||||
log.debug("%s", dict(request.headers))
|
log.debug("%s", dict(request.headers))
|
||||||
@ -51,7 +53,7 @@ class Response(aiohttp.web.Response):
|
|||||||
log.debug(dict(self.headers))
|
log.debug(dict(self.headers))
|
||||||
if hasattr(self, 'body') and self.body is not None and self.headers["CONTENT-TYPE"] == "application/json":
|
if hasattr(self, 'body') and self.body is not None and self.headers["CONTENT-TYPE"] == "application/json":
|
||||||
log.debug(json.loads(self.body.decode('utf-8')))
|
log.debug(json.loads(self.body.decode('utf-8')))
|
||||||
return super().start(request)
|
return (yield from super().prepare(request))
|
||||||
|
|
||||||
def html(self, answer):
|
def html(self, answer):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user