Struct dlog_rs::Builder[][src]

pub struct Builder { /* fields omitted */ }

The builder can be used to more finely configure dlog to best suit your needs.

Examples

#[macro_use]
extern crate log;

use dlog_rs::Builder;

fn main() {
    Builder::new()
        .with_env_api_key("DLOG_API_KEY")
        .with_level(log::Level::Trace)
        .build();

    info!("Hello from Rust!");

    // Flushes all remaining logs when the app exits
    log::logger().flush();
}

Implementations

impl Builder[src]

pub fn new() -> Self[src]

Instantiates a new builder which can be used to configure dlog.

pub fn with_str_api_key(self, api_key: impl Into<String>) -> Self[src]

Injects the API_KEY directly into the builder.

Arguments

  • api_key - The dlog API_KEY for this service.

pub fn with_env_api_key(self, env_var: impl Into<String>) -> Self[src]

Injects the API_KEY into the builder by reading it from an environmental variable.

Arguments

  • env_var - The name of the environmental variable where this API_KEY is stored

pub fn with_level(self, level: Level) -> Self[src]

Sets the minimum level a log must have to be logged to dlog.

Arguments

  • level - The minimum required log level

pub fn build(self)[src]

Consumes the builder and configures dlog according to the builders configuration.

Auto Trait Implementations

impl RefUnwindSafe for Builder

impl Send for Builder

impl Sync for Builder

impl Unpin for Builder

impl UnwindSafe for Builder

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> Instrument 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.