cfg_log
=======
Compile time conditional logging.
[](https://github.com/FedericoStra/cfg_log)
[](https://crates.io/crates/cfg_log)
[](https://docs.rs/cfg_log)
[](https://github.com/FedericoStra/cfg_log/blob/master/LICENSE)
[](https://github.com/FedericoStra/cfg_log/actions/workflows/rust.yml)

## Usage
The main crate should depend on `cfg_log` and optionally on `log`.
```toml
[dependencies]
cfg_log = "0.1.0"
log = { version = "0.4.17", optional = true }
```
Then logging can be done more concisely with
```rust
use cfg_log::*;
fn main() {
debug!("the answer is {}", 42);
}
```
instead of
```rust
#[cfg(feature = "log")]
use log::*;
fn main() {
#[cfg(feature = "log")]
debug!("the answer is {}", 42);
}
```
The `debug!` macro will automatically expand to `log::debug!` if the `log` feature is enabled,
or it will be discarded at compile time otherwise.
See [test_cfg_log](https://github.com/FedericoStra/cfg_log/tree/master/test_cfg_log) for an example package.