Crate measure_time

Source
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"

Macros§

debug
Logs a message at the debug level.
debug_time
logs the time with the debug! macro
error
Logs a message at the error level.
error_time
logs the time with the error! macro
info
Logs a message at the info level.
info_time
logs the time with the info! macro
log
The standard logging macro.
log_enabled
Determines if a message logged at the specified level in that module will be logged.
log_time
print_time
logs the time with the print! macro
trace
Logs a message at the trace level.
trace_time
logs the time with the trace! macro
warn
Logs a message at the warn level.
warn_time
logs the time with the warn! macro

Structs§

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

Enums§

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

Constants§

STATIC_MAX_LEVEL
The statically resolved maximum log level.

Traits§

Log
A trait encapsulating the operations required of a logger.

Functions§

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