app: improve debug logging

Dont log the full response when html is requested.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-08-18 11:33:02 -04:00
parent 2314ea74c2
commit fd5053ecac
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 8 additions and 5 deletions

View File

@ -602,12 +602,15 @@ class DynamicRequestHandler(AuthorizedRequestHandler):
args[key] = value
return args
def _log_debug(self, header: str, args: Dict[str, Any]) -> None:
def _log_debug(self, header: str, args: Any) -> None:
if self.server.is_debug_enabled():
if self.request.path.startswith('/access'):
resp = {key: "<sanitized>" for key in args}
else:
resp = args
resp = args
if isinstance(args, dict):
if self.request.path.startswith('/access'):
resp = {key: "<sanitized>" for key in args}
elif isinstance(args, str):
if args.startswith("<html>"):
resp = "<html>"
logging.debug(f"{header}::{resp}")
async def get(self, *args, **kwargs) -> None: