Enum alto_logger::TimeConfig
source · [−]#[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
Relative
timestamp style- use
TimeConfig::relative_now
to start the clock fromnow
- use
Timing
timestamp style
Note Defaults to the None
timestamp
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
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
sourceimpl TimeConfig
impl TimeConfig
sourcepub fn relative_now() -> Self
pub fn relative_now() -> Self
Create a Relative timestamp starting at ‘now’
sourcepub fn relative_local() -> Self
pub fn relative_local() -> Self
Create a Relative timestamp based on the previous logging statement
sourcepub fn unix_timestamp() -> Self
pub fn unix_timestamp() -> Self
Create a timestamp based on the UNIX epoch (number of seconds since Jan. 1 1970)
sourcepub fn date_time_format(
format_description: &'static [FormatItem<'static>]
) -> Self
pub fn date_time_format(
format_description: &'static [FormatItem<'static>]
) -> Self
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
sourceimpl Clone for TimeConfig
impl Clone for TimeConfig
sourceimpl Debug for TimeConfig
impl Debug for TimeConfig
sourceimpl Default for TimeConfig
impl Default for TimeConfig
sourceimpl From<TimeConfig> for Options
impl From<TimeConfig> for Options
sourcefn from(conf: TimeConfig) -> Self
fn from(conf: TimeConfig) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl RefUnwindSafe for TimeConfig
impl Send for TimeConfig
impl Sync for TimeConfig
impl Unpin for TimeConfig
impl UnwindSafe for TimeConfig
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more