#metrics #logging #printing

metrics_printer

A recorder for the metrics library that prints metric values to an output in regular intervals

2 unstable releases

0.2.0 Feb 4, 2025
0.1.0 Apr 4, 2021

#316 in Debugging

Download history 88/week @ 2025-01-29 117/week @ 2025-02-05 85/week @ 2025-02-12 80/week @ 2025-02-19 87/week @ 2025-02-26 74/week @ 2025-03-05 76/week @ 2025-03-12 77/week @ 2025-03-19 78/week @ 2025-03-26 97/week @ 2025-04-02 103/week @ 2025-04-09 92/week @ 2025-04-16 469/week @ 2025-04-23 74/week @ 2025-04-30 176/week @ 2025-05-07 94/week @ 2025-05-14

824 downloads per month
Used in executors

MIT license

29KB
646 lines

This crate provides you with a [metrics] recorder that can print all metrics to a target of your choice in regular intervals.

It uses a thread to print, so it doesn't interfere with other threads' work directly.

Custom printing targets (e.g., logging frameworks) can be provided via the simple [Printer] trait, while default implementations for stdout and stderr are provided.

Example

use metrics::*;
use metrics_printer::*;

PrintRecorder::default().install().unwrap();
for _i in 0..300 {
    counter!("test.counter").increment(1);
    std::thread::sleep(Duration::from_millis(10));
}

Metrics Printer

License Cargo Documentation

A simple printing recorder for the metrics crate.

Dependencies

~1–1.4MB
~21K SLoC