Make journald an optional feature.
This commit is contained in:
parent
d5b0d76435
commit
39e39cd277
|
@ -15,6 +15,7 @@ default = [ "tokio" ]
|
|||
async-std = [ "tor-client/async-std", "tor-rtcompat/async-std", "async-ctrlc", "once_cell" ]
|
||||
tokio = [ "tokio-crate", "tor-client/tokio", "tor-rtcompat/tokio" ]
|
||||
static = [ "tor-rtcompat/static", "tor-dirmgr/static" ]
|
||||
journald = [ "tracing-journald" ]
|
||||
|
||||
[dependencies]
|
||||
tor-client = { package="arti-tor-client", path = "../tor-client", version="0.0.0" }
|
||||
|
@ -34,4 +35,4 @@ serde = { version = "1.0.124", features = ["derive"] }
|
|||
tracing-subscriber = "0.2.19"
|
||||
tokio-crate = { package="tokio", version = "1.7.0", optional = true, features = ["signal"] }
|
||||
argh = "0.1.4"
|
||||
tracing-journald = "0.1.0"
|
||||
tracing-journald = { version = "0.1.0", optional = true }
|
||||
|
|
|
@ -237,14 +237,15 @@ fn setup_logging(config: &ArtiConfig) {
|
|||
|
||||
let registry = registry().with(fmt::Layer::default()).with(env_filter);
|
||||
|
||||
#[cfg(feature = "journald")]
|
||||
if config.journald {
|
||||
match tracing_journald::layer() {
|
||||
Ok(journald) => registry.with(journald).init(),
|
||||
Err(_err) => registry.init(),
|
||||
};
|
||||
} else {
|
||||
registry.init()
|
||||
if let Ok(journald) = tracing_journald::layer() {
|
||||
registry.with(journald).init();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
registry.init();
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
|
|
Loading…
Reference in New Issue