emit-rs / emit

Developer-first diagnostics for Rust applications
https://emit-rs.io
Apache License 2.0
128 stars 2 forks source link

Support panic_lvl in emit::span #111

Closed KodrAus closed 4 weeks ago

KodrAus commented 2 months ago

If we're attempting to catch a fallible operation, we could also use the err_lvl if the instrumented function panics, or let you set a panic level specifically.

Generally, Rust methods shouldn't panic, but sometimes it happens, and that's something you'll want to know about. The most straightforward way to do this would be to make our default span completion check if it's panicking and complete using the error or panic level, along with a generic err property that suggests the method panicked. If you want to actually catch that panic and report a more useful error then you can do so through panic::catch_unwind.