Use this skill when adding or standardizing logs across a Litestar app.
Workflow
- Configure
logging_configat app creation. - Define environment-specific log levels/handlers.
- Add request correlation IDs and consistent event fields.
- Keep sensitive payloads and secrets out of logs.
Pattern
from litestar import Litestar
from litestar.logging import LoggingConfig
app = Litestar( route_handlers=[], logging_config=LoggingConfig(), )
## Logging Checklist
- Use structured logs in production.
- Include operation name, request ID, and status.
- Avoid duplicate logging between middleware and handlers.
- Reserve stack traces for actionable failure points.
## Litestar References
- https://docs.litestar.dev/latest/usage/logging.html