#[instrument]Expand description
Instruments a function.
§Optional arguments
ctx- Specify a context label (defaults todefault)fmt- Provide a formatting string (defaults to"() => {:?})
§Example
extern crate instrumented;
extern crate log;
use instrumented::instrument;
// Logs at debug level with the `special` context using a custom log format.
#[instrument(DEBUG, ctx = "special", fmt = "{}")]
fn my_func() -> String {
use std::{thread, time};
let ten_millis = time::Duration::from_millis(10);
thread::sleep(ten_millis);
format!("slept for {:?} millis", ten_millis)
}