#[non_exhaustive]
pub enum TimeConfig {
    None,
    Unix,
    Relative(Instant),
    Timing(Mutex<Option<Instant>>),
    DateTime(&'static [FormatItem<'static>]),
}
Expand description

How the timestamp should be displayed

Several helper methods for constructing this type are provided

Note Defaults to the None timestamp

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

None

No timestamp

Unix

Timestamp since the UNIX epoch

Relative(Instant)

Relative timestamp from the start of the program

This prints out a fractional number of seconds from when the logger was initialized.

Timing(Mutex<Option<Instant>>)

Relative timestamp from the previous log statement

This prints out a fractional number of seconds since the last statement was logged

DateTime(&'static [FormatItem<'static>])

Timestamp formatted with from UTC ‘now’. See formatting

This allows you to provide a ‘fixed’ date time. (e.g. UTC offset or unix timestamp or whatever you want)

Implementations

Create a Relative timestamp starting at ‘now’

Create a Relative timestamp based on the previous logging statement

Create a timestamp based on the UNIX epoch (number of seconds since Jan. 1 1970)

Create a DateTime format

See the formatting description here

This requires you to use a statically-parsed format_description.

you can get one via format_description or using a well-known format

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.