You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add StructuredLogger and re-purpose Sentry.logger
* YARD docs for structured logger
* Remove obsolete comment
* Add support for message templates
* Support Hash-based log templates too
* Remove redundant assignment
* Ensure we don't set message.template when body is not a template
* Lazy-load parameters
No need to do this upfront because it is needed only
when a log event actually gets to the envelope
* Reduce object allocations
* Use attr readers consistently
* Remove unused reader
* Update docs
* Fix issues with parameters handling and extra attributes
* Fix spec
* Auto-flush log events when adding and fix flush
* Add enabled_logs toplevel config
* Rework logger init to work with enabled_logs config
* Update CHANGELOG
* Remove unused Device logging class
* More examples in CHANGELOG
* Fix parameter naming in log event attributes
- Add new `Sentry.logger` for [Structured Logging](https://develop.sentry.dev/sdk/telemetry/logs/) feature ([#2620](https://github.com/getsentry/sentry-ruby/pull/2620)).
17
+
18
+
To enable structured logging you need to turn on the `enable_logs` configuration option:
19
+
```ruby
20
+
Sentry.init do |config|
21
+
# ... your setup ...
22
+
config.enable_logs =true
23
+
end
24
+
```
25
+
26
+
Once you configured structured logging, you get access to a new `Sentry.logger` object that can be
27
+
used as a regular logger with additional structured data support:
28
+
29
+
```ruby
30
+
Sentry.logger.info("User logged in", user_id:123)
31
+
32
+
Sentry.logger.error("Failed to process payment",
33
+
transaction_id:"tx_123",
34
+
error_code:"PAYMENT_FAILED"
35
+
)
36
+
```
37
+
38
+
You can also use message templates with positional or hash parameters:
:warning: When `enable_logs` is `true`, previous `Sentry.logger` should no longer be used for internal SDK
54
+
logging - it was replaced by `Sentry.configuration.sdk_logger` and should be used only by the SDK
55
+
itself and its extensions.
56
+
17
57
- New configuration option called `active_job_report_on_retry_error` which enables reporting errors on each retry error ([#2617](https://github.com/getsentry/sentry-ruby/pull/2617))
0 commit comments