cleanup logging

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-06-02 08:03:27 +02:00
parent bd47b693d2
commit 3c2a742f40
7 changed files with 16 additions and 12 deletions
+2 -2
View File
@@ -44,7 +44,7 @@ def setup_middleware(app: FastAPI, cmd_opts):
client = req.scope.get('client', ('0:0.0.0', 0))[0]
token = req.cookies.get("access-token") or req.cookies.get("access-token-unsecure")
validate_request(client, endpoint)
if (cmd_opts.api_log):
if cmd_opts.api_log:
if not validate_log(client, endpoint):
return res
log.info('API user={user} code={code} {prot}/{ver} {method} {endpoint} {client} {duration}'.format( # pylint: disable=consider-using-f-string, logging-format-interpolation
@@ -103,4 +103,4 @@ def setup_middleware(app: FastAPI, cmd_opts):
return handle_exception(req, e)
app.build_middleware_stack() # rebuild middleware stack on-the-fly
log.debug(f'API middleware: {[m.cls for m in app.user_middleware]}')
log.debug(f'API middleware: {[m.cls.__name__ for m in app.user_middleware]}')