Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Skip The `self`` Argument When Instrumenting Tracing On A Rust Function

Code

```cargo
[dependencies]
tracing = "0.1"
tracing-subscriber = "0.3"
```
use tracing::{Level, event, instrument};

fn main() {
  tracing_subscriber::fmt().with_ansi(false).init();
  let w = Widget{};
  w.instrument_with_self();
  w.instrument_without_self();
}

#[derive(Debug)]
pub struct Widget{}

impl Widget {
  #[instrument]
  pub fn instrument_with_self(&self) {
    event!(Level::INFO, "ping");
  }
  #[instrument(skip(self))]
  pub fn instrument_without_self(&self) {
    event!(Level::INFO, "ping");
  }
}

Results

2024-02-29T00:49:19.740982Z  INFO instrument_with_self{self=Widget}: _active_nvim_run: ping
2024-02-29T00:49:19.741050Z  INFO instrument_without_self: _active_nvim_run: ping