Expand description

The crate provides macros, which measure the time in ms until end of scope

This is done by creating an object, which measures the time. The time is printed when the object is dropped.

The logging behaviour is the same as other log macros like info!(..)

Examples

use measure_time::{info_time, debug_time, trace_time, error_time, print_time};
info_time!("measure function");
{
    debug_time!("{:?}", "measuring block");
    let mut sum = 0;
    for el in 0..50000 {
        sum+=el;
    }
    println!("{:?}", sum);
}
trace_time!("{:?}", "trace");
print_time!("print");
error_time!(target: "measure_time", "custom target");
// --> prints "yep took ...", "measuring function took 0.0135ms"

Modules

UNSTABLE: Structured key-value pairs.

Macros

Get a value from a type implementing std::fmt::Debug.
Get a value from a type implementing std::fmt::Display.
Get a value from an error.
Logs a message at the debug level.
logs the time with the debug! macro
Logs a message at the error level.
logs the time with the error! macro
Logs a message at the info level.
logs the time with the info! macro
The standard logging macro.
Determines if a message logged at the specified level in that module will be logged.
logs the time with the print! macro
Logs a message at the trace level.
logs the time with the trace! macro
Logs a message at the warn level.
logs the time with the warn! macro

Structs

Metadata about a log message.
The type returned by from_str when the string doesn’t match any of the log levels.
The “payload” of a log message.
Builder for Record.
The type returned by set_logger if set_logger has already been called.

Enums

An enum representing the available verbosity levels of the logger.
An enum representing the available verbosity level filters of the logger.

Constants

The statically resolved maximum log level.

Traits

A trait encapsulating the operations required of a logger.

Functions

Returns a reference to the logger.
Returns the current maximum log level.
Sets the global logger to a Box<Log>.
Sets the global logger to a &'static Log.
A thread-unsafe version of set_logger.
Sets the global maximum log level.
A thread-unsafe version of set_max_level.