File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
docs/platforms/rust/common/logs Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ fn main() {
103103
104104 let sentry_layer =
105105 sentry :: integrations :: tracing :: layer (). event_filter (| md | match * md . level () {
106- // Capture error events as Sentry events
106+ // Capture error level events as Sentry events
107107 // These are grouped into issues, representing high-severity errors to act upon
108108 tracing :: Level :: ERROR => EventFilter :: Event ,
109109 // Ignore trace level events, as they're too verbose
@@ -132,6 +132,22 @@ fn main() {
132132
133133The fields of ` tracing ` events are automatically captured as attributes in Sentry logs.
134134
135+ To map a ` tracing ` event to multiple items in Sentry (e.g. both an event and a log), combine multiple event filters using the bitwise or operator.
136+
137+ ``` rust
138+ use sentry :: integrations :: tracing :: EventFilter ;
139+
140+ let sentry_layer =
141+ sentry :: integrations :: tracing :: layer (). event_filter (| md | match * md . level () {
142+ // Capture error and warn level events as both logs and events in Sentry
143+ tracing :: Level :: ERROR | tracing :: Level :: WARN => EventFilter :: Event | EventFilter :: Log ,
144+ // Ignore trace level events, as they're too verbose
145+ tracing :: Level :: TRACE => EventFilter :: Ignore ,
146+ // Capture everything else just as a log
147+ _ => EventFilter :: Log ,
148+ });
149+ ```
150+
135151### ` log ` Integration
136152
137153To use the ` log ` integration with logs, add the necessary dependencies to your ` Cargo.toml ` .
You can’t perform that action at this time.
0 commit comments