instrument

Attribute Macro instrument 

Source
#[instrument]
Expand description

Instruments a function with some sane defaults by automatically:

  • setting the attribute behind the “tracing” flag
  • adding servo_profiling = true in the tracing::instrument(fields(...)) argument.
  • setting level = "trace" if it is not given.

This macro assumes the consuming crate has a tracing feature flag.

We need to be able to set the following

#[cfg_attr(
        feature = "tracing",
        tracing::instrument(
            name = "MyCustomName",
            skip_all,
            fields(servo_profiling = true),
            level = "trace",
        )
    )]
fn my_fn() { /* .... */ }

from a simpler macro, such as:

#[servo_tracing::instrument(name = "MyCustomName", skip_all)]
fn my_fn() { /* .... */ }