Macro defmt::timestamp[][src]

timestamp!() { /* proc-macro */ }
Expand description

Defines the global timestamp provider for defmt.

This macro can be used to attach a timestamp or other data to every defmt message. Its syntax works exactly like the logging macros, except that no local variables can be accessed and the macro should be placed in a module instead of a function.

timestamp! must only be used once across the crate graph.

If no crate defines a timestamp, no timestamp will be included in the logged messages.

Examples


static COUNT: AtomicU32 = AtomicU32::new(0);
defmt::timestamp!("{=u32:µs}", COUNT.fetch_add(1, Ordering::Relaxed));