pub struct DeferredNow(/* private fields */);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§
Source§impl<'a> DeferredNow
impl<'a> DeferredNow
Sourcepub fn now(&'a mut self) -> &'a DateTime<Local>
pub fn now(&'a mut self) -> &'a DateTime<Local>
Retrieve the timestamp for local time zone.
Requires mutability because the first caller will generate the timestamp.
Sourcepub fn now_utc_owned(&'a mut self) -> DateTime<Utc>
pub fn now_utc_owned(&'a mut self) -> DateTime<Utc>
Retrieve the UTC timestamp.
Requires mutability because the first caller will generate the timestamp.
Sourcepub fn format<'b>(
&'a mut self,
fmt: &'b str,
) -> DelayedFormat<StrftimeItems<'b>>
pub fn format<'b>( &'a mut self, fmt: &'b str, ) -> DelayedFormat<StrftimeItems<'b>>
Produces a preformatted object suitable for printing.
§Panics
Panics if fmt has an inappropriate value.
Sourcepub fn format_rfc3339(&mut self) -> String
pub fn format_rfc3339(&mut self) -> String
Prints itself in a format compliant with RFC 3339.
Example: 2021-04-29T13:14:15.678+01:00
We do not use the Z variant of RFC 3339, because it is often misinterpreted.
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§
Source§impl Debug for DeferredNow
impl Debug for DeferredNow
Source§impl Default for DeferredNow
impl Default for DeferredNow
Source§fn default() -> DeferredNow
fn default() -> DeferredNow
Auto Trait Implementations§
impl Freeze for DeferredNow
impl RefUnwindSafe for DeferredNow
impl Send for DeferredNow
impl Sync for DeferredNow
impl Unpin for DeferredNow
impl UnwindSafe for DeferredNow
Blanket Implementations§
Source§impl<T> AsAny for Twhere
T: Any,
impl<T> AsAny for Twhere
T: Any,
Source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
&dyn Any.