Skip to content
Snippets Groups Projects
Commit 364b90cb authored by Xiao Gui's avatar Xiao Gui
Browse files

maint: do not log ready endpoint

debug: add debug for plugin
parent b66ff5cf
No related branches found
No related tags found
No related merge requests found
......@@ -57,3 +57,19 @@ if HOST_PATHNAME:
app.mount(HOST_PATHNAME, _app)
ready_flag = True
DO_NOT_LOGS = (
"/ready",
"/metrics",
)
import logging
class EndpointLoggingFilter(logging.Filter):
"""Custom logger filter. Do not log metrics, ready endpoint."""
def filter(self, record: logging.LogRecord) -> bool:
message = record.getMessage()
return all(
message.find(do_not_log) == -1 for do_not_log in DO_NOT_LOGS
)
logging.getLogger("uvicorn.access").addFilter(EndpointLoggingFilter())
......@@ -64,7 +64,7 @@ def _get_manifest(url: str):
return return_obj
except Exception as e:
logger.error(f"Error retrieving: {url}")
logger.error(f"Error retrieving: {url}, {str(e)}")
@router.get("/manifests")
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment