mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-12 20:38:23 +00:00
Improve server debug logging
This commit is contained in:
@ -36,14 +36,17 @@ class Response(aiohttp.web.Response):
|
||||
super().__init__(headers=headers, **kwargs)
|
||||
|
||||
def start(self, request):
|
||||
log.debug("{} {}".format(self.status, self.reason))
|
||||
log.debug(dict(self.headers))
|
||||
if log.getEffectiveLevel() == logging.DEBUG:
|
||||
log.info("%s %s", request.method, request.path_qs)
|
||||
log.debug("%s", dict(request.headers))
|
||||
if isinstance(request.json, dict):
|
||||
log.debug("%s", request.json)
|
||||
log.info("Response: %d %s", self.status, self.reason)
|
||||
log.debug(dict(self.headers))
|
||||
if hasattr(self, 'body'):
|
||||
log.debug(json.loads(self.body.decode('utf-8')))
|
||||
return super().start(request)
|
||||
|
||||
def write(self, data):
|
||||
log.debug(data)
|
||||
return super().write(data)
|
||||
|
||||
def json(self, answer):
|
||||
"""
|
||||
Set the response content type to application/json and serialize
|
||||
|
Reference in New Issue
Block a user