pub struct Client { /* private fields */ }Expand description
dontpanic library client.
Implementations§
source§impl Client
impl Client
sourcepub fn set_logger(&self, logger: impl Log + 'static) -> Result<(), Error>
Available on crate feature log only.
pub fn set_logger(&self, logger: impl Log + 'static) -> Result<(), Error>
log only.Register a Log implementor with this library, this sets it as the default logger. Works with any type that implements Log
See Available logging implementations in the log crate.
Example with env_logger:
fn main() {
let client = dontpanic::builder("<PROJECT_API_KEY>").build().unwrap()
// Important: call .build() not .init()
let logger = env_logger::Builder::from_default_env().build();
client.set_logger(logger)?;
log::info!("Luke, I am your father.");
panic!("Noooooo");
}sourcepub fn tracing_layer(&self) -> TracingLayer
Available on crate feature tracing only.
pub fn tracing_layer(&self) -> TracingLayer
tracing only.Creates and returns a tracing Layer implementation.
Use with tracing_subscriber::registry to create a Layer stack and add this layer alongside your chosen tracing subscriber implementation.
Example with tracing_subscriber::fmt:
fn main() {
let client = dontpanic::builder("<PROJECT_API_KEY>").build().unwrap()
tracing_subscriber::registry()
.with(tracing_subscriber::fmt::layer())
.with(client.tracing_layer())
.init();
log::info!("Mr. Stark, I don't feel so good");
panic!("Noooooo");
}Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more