Skip to content

Commit

Permalink
Merge pull request #230 from chloekek/yeet-log
Browse files Browse the repository at this point in the history
Make the log dependency optional
  • Loading branch information
frewsxcv committed Jan 19, 2023
2 parents 212b1c4 + cb1cc51 commit 33b0f26
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Expand Up @@ -11,17 +11,17 @@ repository = "https://github.com/tiny-http/tiny-http"
edition = "2018"

[features]
default = []
default = ["log"]
ssl = ["ssl-openssl"]
ssl-openssl = ["openssl", "zeroize"]
ssl-rustls = ["rustls", "rustls-pemfile", "zeroize"]

[dependencies]
ascii = "1.0"
chunked_transfer = "1"
log = "0.4.4"
httpdate = "1.0.2"

log = { version = "0.4.4", optional = true }
openssl = { version = "0.10", optional = true }
rustls = { version = "0.20", optional = true }
rustls-pemfile = { version = "0.2.1", optional = true }
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Expand Up @@ -119,6 +119,7 @@ pub use test::TestRequest;
mod client;
mod common;
mod connection;
mod log;
mod request;
mod response;
mod ssl;
Expand Down
17 changes: 17 additions & 0 deletions src/log.rs
@@ -0,0 +1,17 @@
#[cfg(feature = "log")]
pub(crate) use log::{debug, error};

#[cfg(not(feature = "log"))]
macro_rules! _debug {
(target: $target:expr, $($arg:tt)+) => {};
($($arg:tt)+) => {};
}

#[cfg(not(feature = "log"))]
macro_rules! _error {
(target: $target:expr, $($arg:tt)+) => {};
($($arg:tt)+) => {};
}

#[cfg(not(feature = "log"))]
pub(crate) use {_debug as debug, _error as error};

0 comments on commit 33b0f26

Please sign in to comment.