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
sourceimpl Builder
impl Builder
sourcepub fn with_str_api_key(self, api_key: impl Into<String>) -> Self
pub fn with_str_api_key(self, api_key: impl Into<String>) -> Self
Injects the API_KEY directly into the builder.
Arguments
api_key
- The dlog API_KEY for this service.
sourcepub fn with_env_api_key(self, env_var: impl Into<String>) -> Self
pub fn with_env_api_key(self, env_var: impl Into<String>) -> Self
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
sourcepub fn with_level(self, level: Level) -> Self
pub fn with_level(self, level: Level) -> Self
Sets the minimum level a log must have to be logged to dlog.
Arguments
level
- The minimum required log level
sourcepub fn with_email_sanitizer(self) -> Self
pub fn with_email_sanitizer(self) -> Self
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.
sourcepub fn with_credit_card_sanitizer(self) -> Self
pub fn with_credit_card_sanitizer(self) -> Self
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.
Trait Implementations
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more