Provides a couple of simple timers that log messages indicating the elapsed time between their creation and dropping. Messages are output via the log crate.
Timers have names, and the log messages are constructed in such a way that they contain the module, filename and line number of the place where the timer was constructed.
Timers are usually created using the timer!
or stimer!
macros. The difference is
that timer!
returns a timer that logs a message only when it is dropped, while stimer!
returns a timer that logs a started message as soon as it is created, and a finished
message when it is dropped.
Example - "Find Files" is the name of the timer:
```rust use logging_timer::{timer};
fn find_files(dir: PathBuf) -> List
You can replace timer!
with stimer!
to get a timer that logs a starting message as
well, giving you a pair of 'bracketing' log messages.
In addition, both timer macros accept format_args! style parameters, allowing you to include extra information in the log messages.
norun
let tmr = timer!("Find Files", "Directory = {}", dir);
See the module documentation for more examples and an example of the output format.