[−][src]Struct logging_timer::LoggingTimer
When this struct is dropped, it logs a message stating its name and how long the execution time was. Can be used to time functions or other critical areas.
Methods
impl<'name> LoggingTimer<'name>[src]
pub fn new(
file: &'static str,
module_path: &'static str,
line: u32,
name: &'name str,
extra_info: Option<String>
) -> Self[src]
file: &'static str,
module_path: &'static str,
line: u32,
name: &'name str,
extra_info: Option<String>
) -> Self
Constructs a new LoggingTimer that prints only a 'TimerFinished' message.
This method is not usually called directly, use the timer! macro instead.
pub fn with_start_message(
file: &'static str,
module_path: &'static str,
line: u32,
name: &'name str,
extra_info: Option<String>
) -> Self[src]
file: &'static str,
module_path: &'static str,
line: u32,
name: &'name str,
extra_info: Option<String>
) -> Self
Constructs a new LoggingTimer that prints a 'TimerStarting' and a 'TimerFinished' message.
This method is not usually called directly, use the stimer! macro instead.
pub fn elapsed(&self) -> Duration[src]
Returns how long the timer has been running for.
pub fn level(self, level: Level) -> Self[src]
Sets the logging level. Note that this consumes self, so that it can be called in a one-liner like this:
let tmr = timer!("foo").level(Level::Trace);
pub fn executing(&self, args: Option<Arguments>)[src]
Outputs a log message with a target of 'TimerExecuting' showing the current elapsed time, but does not
stop the timer. This method can be called multiple times.
The message can include further information via a format_args! approach.
This method is usually not called directly, it is easier to use the executing! macro.
pub fn finish(&self, args: Option<Arguments>)[src]
Outputs a log message with a target of 'TimerFinished' and suppresses the normal message
that is output when the timer is dropped. The message can include further format_args!
information. This method is normally called using the finish! macro. Calling
finish() again will have no effect.
Trait Implementations
impl<'a> Drop for LoggingTimer<'a>[src]
Auto Trait Implementations
impl<'name> Send for LoggingTimer<'name>
impl<'name> Sync for LoggingTimer<'name>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,