tokio-rs / tracing

Application level tracing for Rust.
https://tracing.rs
MIT License
5.33k stars 697 forks source link

Support `#[instrument]` on impl Blocks #2852

Open ModProg opened 7 months ago

ModProg commented 7 months ago

Feature Request

Crates

tracing

Motivation

When you have all the functions that make sense to instrument inside an impl block, it would be nice to have a single #[instrument] on the whole block instead of every function.

Proposal

When #[instrument] is put on, an impl block (or a trait implementation), for each function inside this block without an #[instrument] attribute on its own, apply the attribute.

Alternatives

Keep manually duplicating it on each function.