feat(logs): support for capture_* config#1077
Conversation
fe54e9f to
d030abf
Compare
|
@PJUllrich would that be a good solution in your case? 😄 |
|
@solnic yes, I think so! Thank you! ❤️💚💛💜💙❤️ |
d030abf to
e071445
Compare
| capture_log_messages: Config.logs_capture_log_messages?(), | ||
| metadata: Config.logs_capture_metadata(), | ||
| excluded_domains: Config.logs_capture_excluded_domains() | ||
| } |
There was a problem hiding this comment.
Capture level filters crash reports
Medium Severity
The auto-attached handler always sets its level from logs.capture_level, and ErrorBackend drops any log event below that threshold before crash handling runs. That means a capture_level above typical crash severities (e.g. :critical) can suppress crash reporting, even when capture_log_messages is false or the docs describe crashes as always on and capture_level as applying only to captured log messages.
Reviewed by Cursor Bugbot for commit 60941f7. Configure here.
60941f7 to
eabaea9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit eabaea9. Configure here.
| # settings reach the ErrorBackend, whose options are frozen at attach time and would | ||
| # otherwise stay stale across the restart. | ||
| auto_logger_handler_registered?() -> | ||
| _ = :logger.update_handler_config(:sentry_log_handler, :config, handler_config) |
There was a problem hiding this comment.
Restart resets handler options
Medium Severity
When the auto :sentry_log_handler survives a :sentry restart, re-sync calls :logger.update_handler_config/3 with only the four capture-related keys. Sentry.LoggerHandler.changing_config/3 validates that map through the full NimbleOptions schema, so omitted options are filled with defaults and overwrite existing handler settings such as :rate_limiting, :sync_threshold, and :tags_from_metadata.
Reviewed by Cursor Bugbot for commit eabaea9. Configure here.


This adds support for configuring the log handler error capturing - which is different from sending error logs and crashes.
Two new options are added go
:logsconfig:capture_log_messages- toggle capturing on / offcapture_level- the log level for capturing (distinct fromlogs.levelconfig)capture_metadata- which metadata is accepted when capturing log messagescapture_excluded_domains- which logging domains must be excluded when capturing log messagesThis is the first step towards deprecating the original
Sentry.LoggerBackendasSentry.LoggerHandleris replacing it, handling both structured logging and capturing logs as Sentry events.Refs #1036