Use Logfire directly for application logging#85
Conversation
Subhransu-De
commented
Jul 12, 2026
- Use direct Logfire calls for application lifecycle and exception events.
- Keep the stock Logfire handler for Uvicorn and third-party logs with health filtering.
- Remove the duplicate JSON logging path and refresh tests and the issue audit.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80fcc6e306
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| logfire.info( | ||
| "Starting up {service_name} on port {port}", | ||
| service_name=app_settings.app_name, | ||
| port=app_settings.port, | ||
| ) |
There was a problem hiding this comment.
Preserve logs when Logfire is not configured
In the default Compose/container path no LOGFIRE_TOKEN is supplied, and configure_otel() sets send_to_logfire="if-token-present" with console=False. After replacing the stdout-backed logger.info/logger.exception path with direct logfire.* calls, lifecycle and unhandled-exception diagnostics are silently dropped unless a Logfire token is configured, which makes default local/container failures much harder to diagnose. Please keep a stdout/stderr fallback or only route these messages exclusively through Logfire when an exporter is actually configured.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Enabled Logfire console output without a token so local and container diagnostics remain visible.
|


