Struct custom_utils::logger::DeferredNow
source · [−]pub struct DeferredNow(_);
Expand description
Deferred timestamp creation.
Is used to ensure that a log record that is sent to multiple outputs (in maybe different formats) always uses the same timestamp.
Implementations
sourceimpl DeferredNow
impl DeferredNow
sourcepub fn new() -> DeferredNow
pub fn new() -> DeferredNow
Constructs a new instance, but does not generate the timestamp.
sourcepub fn now(&mut self) -> &OffsetDateTime
pub fn now(&mut self) -> &OffsetDateTime
Retrieve the timestamp.
Requires mutability because the first caller will generate the timestamp.
sourcepub fn format(&mut self, fmt: &impl Formattable) -> String
pub fn format(&mut self, fmt: &impl Formattable) -> String
sourcepub fn force_utc()
pub fn force_utc()
Enforce the use of UTC rather than local time.
By default, flexi_logger
uses or tries to use local time.
By calling early in your program either Logger::use_utc()
or directly this method,
you can override this to always use UTC.
Panics
Panics if called too late, i.e., if DeferredNow::now
was already called before on
any instance of DeferredNow
.
Trait Implementations
sourceimpl Debug for DeferredNow
impl Debug for DeferredNow
sourceimpl Default for DeferredNow
impl Default for DeferredNow
sourcefn default() -> DeferredNow
fn default() -> DeferredNow
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for DeferredNow
impl Send for DeferredNow
impl Sync for DeferredNow
impl Unpin for DeferredNow
impl UnwindSafe for DeferredNow
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