Repository navigation
Conversation
Prefix messages before passing them to loggers so formatters that ignore progname retain the Bugsnag namespace. Preserve lazy logging and the default output format while avoiding duplicate prefixes.
There was a problem hiding this comment.
🟡 Changes recommended
It introduces an API/contract behavior change for logger progname handling and includes a small but concrete formatting bug for empty/nil messages that should be addressed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR aims to ensure Bugsnag attribution is preserved in log output by embedding the [Bugsnag] namespace directly into log messages (rather than relying on progname), and expands spec coverage around logging behavior and session-delivery warnings.
Changes:
- Prefix Bugsnag log messages with
[Bugsnag]before passing them to the configured logger. - Update default logger formatter to avoid duplicate
[Bugsnag]prefixes (including:variants). - Update/add specs to validate attribution behavior across multiple logging scenarios (on_error, breadcrumbs, sessions).
File summaries
| File | Description |
|---|---|
| lib/bugsnag/configuration.rb | Prefixes log messages and adjusts default formatter to keep output attribution consistent/idempotent. |
| spec/session_tracker_spec.rb | Adds coverage asserting session-delivery invalid API key warnings include [Bugsnag]. |
| spec/on_error_spec.rb | Updates expectations to assert [Bugsnag] appears in the emitted message (not via progname). |
| spec/integrations/logger_spec.rb | Updates expected API key warning format to match new prefixing style. |
| spec/configuration_spec.rb | Adjusts formatter expectations and adds coverage for default formatter idempotency. |
| spec/bugsnag_spec.rb | Updates expectations for internal notify error logging to include [Bugsnag] in message body. |
| spec/breadcrumbs/validator_spec.rb | Updates breadcrumb ignore logging to include [Bugsnag] attribution in message body. |
| spec/breadcrumbs/on_breadcrumb_callback_list_spec.rb | Updates callback error logging expectations to include [Bugsnag] in message body. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Restore PROG_NAME as the logger progname argument so consumers that read progname separately from the message (structured logging, custom formatters) keep the previous contract. The message prefix still guarantees attribution for formatters that discard progname, so both audiences are served. Return the bare prefix for nil or empty messages instead of "[Bugsnag] ", which left a trailing space and was inconsistent with the idempotency rule that a message already starting with the prefix is passed through unchanged.
|
Hi @aspiers, Thanks for taking the time to raise this PR! Our engineers will take a look, and leave any comments or updates on this PR accordingly. |
Summary
[Bugsnag]namespace to each message before handing it to the configured logger, so formatters that discardprognameretain attributionFixes #725
Testing
lib/bugsnag/configuration.rbclean