Skip to content

Commit d99843b

Browse files
committed
Allow logging to be disabled
This is a somewhat nontraditioonal use of features, but I don't want to make logging opt in. Closes #215
1 parent a624abc commit d99843b

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ with-serde_json = ["serde_json"]
3131
with-time = ["time"]
3232
with-uuid = ["uuid"]
3333

34+
no-logging = []
35+
3436
[dependencies]
3537
bufstream = "0.1"
3638
fallible-iterator = "0.1.3"

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
extern crate bufstream;
7474
extern crate fallible_iterator;
7575
extern crate hex;
76+
#[cfg(not(feature = "no-logging"))]
7677
#[macro_use]
7778
extern crate log;
7879
extern crate phf;

src/macros.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,13 @@ macro_rules! bad_response {
2525
return Err(::error::Error::Io(::bad_response()));
2626
})
2727
}
28+
29+
#[cfg(feature = "no-logging")]
30+
macro_rules! debug {
31+
($($t:tt)*) => {}
32+
}
33+
34+
#[cfg(feature = "no-logging")]
35+
macro_rules! info {
36+
($($t:tt)*) => {}
37+
}

0 commit comments

Comments
 (0)