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() {
103
103
104
104
let sentry_layer =
105
105
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
107
107
// These are grouped into issues, representing high-severity errors to act upon
108
108
tracing :: Level :: ERROR => EventFilter :: Event ,
109
109
// Ignore trace level events, as they're too verbose
@@ -132,6 +132,22 @@ fn main() {
132
132
133
133
The fields of ` tracing ` events are automatically captured as attributes in Sentry logs.
134
134
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
+
135
151
### ` log ` Integration
136
152
137
153
To 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