You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[19.0] endpoint_log: log endpoint calls in database with api_log #190
Endpoints currently leave no database record of the calls they receive. The log() helper available to code snippets writes manual messages to ir.logging, and nothing records the request and response themselves.
OCA/rest-framework already provides a generic model for this. api_log stores the URL, method, sanitised headers, body, status, timing and stack trace in api.log, and its api.log_collection.mixin adds a log switch and a Logs button to any model. fastapi_log is the bridge for fastapi.endpoint. The 19.0 migration is OCA/rest-framework#616.
I'd like to contribute an endpoint_log bridge for endpoint.endpoint, and I have a working version for 19.0:
Logging hooks into ir.http._dispatch, which receives the functools.partial that endpoint_route_handler registers for each route. The endpoint record is resolved from it. The controller is not overridden, because routes call it by its dotted path.
Logs are written through a separate cursor, as in fastapi_log, so the logs of failed calls are kept.
api_log depends only on web, so the dependency stays light.
Question for maintainers: where should this module live?
In web-api, depending on OCA/rest-framework for api_log.
In rest-framework, next to fastapi_log, depending on web-api for endpoint.
I'd lean towards web-api, since the module is about endpoints, but I'm happy to go either way.
Activity