mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-11-20 11:21:14 +00:00
Support RUST_LOG
This commit is contained in:
parent
bfc2410552
commit
7e215c691b
1 changed files with 24 additions and 0 deletions
|
@ -73,6 +73,18 @@ pub(crate) fn configure_without_clap<P: AsRef<Path>, T: serde::Serialize, Q: AsR
|
|||
ConfigSource::Memory { values } => config.add_source(config::Config::try_from(&values)?),
|
||||
};
|
||||
|
||||
let config = if let Ok(targets) = std::env::var("RUST_LOG") {
|
||||
config.add_source(config::Config::try_from(&serde_json::json!({
|
||||
"tracing": {
|
||||
"logging": {
|
||||
"targets": targets,
|
||||
}
|
||||
}
|
||||
}))?)
|
||||
} else {
|
||||
config
|
||||
};
|
||||
|
||||
let built = config
|
||||
.add_source(
|
||||
config::Environment::with_prefix("PICTRS")
|
||||
|
@ -109,6 +121,18 @@ pub(crate) fn configure() -> color_eyre::Result<PictRsConfiguration> {
|
|||
config
|
||||
};
|
||||
|
||||
let config = if let Ok(targets) = std::env::var("RUST_LOG") {
|
||||
config.add_source(config::Config::try_from(&serde_json::json!({
|
||||
"tracing": {
|
||||
"logging": {
|
||||
"targets": targets,
|
||||
}
|
||||
}
|
||||
}))?)
|
||||
} else {
|
||||
config
|
||||
};
|
||||
|
||||
let built = config
|
||||
.add_source(
|
||||
config::Environment::with_prefix("PICTRS")
|
||||
|
|
Loading…
Reference in a new issue