Update confserver.py

Handle logging of FileHandler response/octet-stream.
This commit is contained in:
Brian Martin 2019-12-30 16:13:42 -05:00
parent 75aa74f39c
commit 18adff2178

View file

@ -252,6 +252,7 @@ class ConfServer:
postbody = None
response = await handler(request)
if not "application/octet-stream" in response.content_type:
logall = {
"request": {
"route_name": f"{request.match_info.route.name}",
@ -268,6 +269,22 @@ class ConfServer:
"status": f"{response.status}",
}
}
else:
logall = {
"request": {
"route_name": f"{request.match_info.route.name}",
"method": f"{request.method}",
"path": f"{request.path}",
"query_string": f"{request.query_string}",
"raw_path": f"{request.raw_path}",
"raw_headers": f'{",".join(map("{}".format, request.raw_headers))}',
"body": f"{postbody}",
},
"response": {
"status": f"{response.status}",
}
}
confserverlog.debug(json.dumps(logall))