Struct flexi_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 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 + ?Sized) -> String
pub fn format(&mut self, fmt: &impl Formattable + ?Sized) -> 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
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more