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§
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.
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 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
Returns the “default value” for a type. Read more