Skip to content

Instantly share code, notes, and snippets.

@DFilyushin
Created August 26, 2021 05:44
Show Gist options
  • Save DFilyushin/7862b27cb0afc0fe8284320ed37d9eac to your computer and use it in GitHub Desktop.
Save DFilyushin/7862b27cb0afc0fe8284320ed37d9eac to your computer and use it in GitHub Desktop.
Disable access log for FastAPI
class EndpointFilter(logging.Filter):
def filter(self, record: logging.LogRecord) -> bool:
return record.getMessage().find("/endpoint") == -1
# Filter out /endpoint
logging.getLogger("uvicorn.access").addFilter(EndpointFilter())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment