From 38b72af3963a08f0c4fe7e1ab34b235e2ee1a3c1 Mon Sep 17 00:00:00 2001 From: rascul Date: Sat, 16 Mar 2024 16:13:58 -0500 Subject: [PATCH] add log::SetLoggerError behind feature flag --- Cargo.toml | 1 + src/lib.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index a956dda..a617c73 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ keywords = ["error", "result"] [dependencies] askama = { version = "0.12", optional = true } +log = { version = "0.4", features = ["std"], optional = true } serde_json = { version = "1.0", optional = true } ureq = { version = "2.6", optional = true } diff --git a/src/lib.rs b/src/lib.rs index 485bcff..a1f7b80 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -76,6 +76,13 @@ impl From for Rear { } } +#[cfg(feature = "log")] +impl From for Rear { + fn from(error: log::SetLoggerError) -> Self { + Self { message: error.to_string(), error: error.into() } + } +} + #[cfg(feature = "serde_json")] impl From for Rear { fn from(error: serde_json::Error) -> Self {