pub struct Builder { /* private fields */ }
Expand description

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

Examples

#[macro_use]
extern crate log;

use dlog::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

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

Injects the API_KEY directly into the builder.

Arguments
  • api_key - The dlog API_KEY for this service.

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

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

Arguments
  • level - The minimum required log level

Adds the a email sanitizer which tries to remove all email addresses from the log messages. This is a best effort sanitizer and there is no guarantee the it will catch 100% of all valid email addresses.

Adds the a credit card sanitizer which tries to remove all credit card number from the log messages. This is a best effort sanitizer and there is no guarantee the it will catch 100% of all credit card formats.

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

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more