Struct kvlogger::KvLoggerBuilder[][src]

pub struct KvLoggerBuilder { /* fields omitted */ }

A builder to create and register kvlogger

Examples

use std::error::Error;
use log::Level;
use kvlogger::*;

fn main() -> Result<(), Box<dyn Error>> {
  KvLoggerBuilder::default().init()?;

  KvLoggerBuilder::default()
    .set_level(Level::Debug)
    .set_datetime_format("%Y-%m-%d")
    .init()?;

  Ok(())
}

Implementations

impl KvLoggerBuilder[src]

pub fn set_level(mut self: Self, level: Level) -> KvLoggerBuilder[src]

Force the maximum log level to be printed. If not given, the value of the RUST_LOG environment variable is considered.

Defaults to Error.

pub fn set_datetime_format<S>(mut self: Self, format: S) -> KvLoggerBuilder where
    S: Into<String>, 
[src]

Change the datetime format used for timestamps

This method does not have any effect unless the datetime feature is opted into. If it is not, the datetime timestamps is replaced with the current UNIX milliseconds timestamp.

Defaults to %Y-%m-%dT%H:%M:%S.3f%z.

pub fn init(self) -> Result<(), SetLoggerError>[src]

Finalize the builder and register the logger

This method closes the builder by moving it and registers kvlogger as the default log system for the current program.

Trait Implementations

impl Default for KvLoggerBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.