feat: allow setting misc.log_filters in config.toml (#552)
Allow setting `log_filters` in `config.toml` This allows setting a list of `log_filters` in the `[misc]` section in the `config.toml`. These filters are prepended to any filters listed with `--log-filters`. Finally, `--verbose` can now be used with `--log-filters`, and it will append `debug` to the list of filters rather than replacing it entirely.
This commit is contained in:
@@ -436,6 +436,8 @@ pub struct Misc {
|
||||
only: Option<Vec<Step>>,
|
||||
|
||||
no_self_update: Option<bool>,
|
||||
|
||||
log_filters: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug, Merge)]
|
||||
@@ -832,14 +834,6 @@ impl CommandLineArgs {
|
||||
pub fn env_variables(&self) -> &Vec<String> {
|
||||
&self.env
|
||||
}
|
||||
|
||||
pub fn tracing_filter_directives(&self) -> String {
|
||||
if self.verbose {
|
||||
"debug".into()
|
||||
} else {
|
||||
self.log_filter.clone()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents the application configuration
|
||||
@@ -1390,6 +1384,19 @@ impl Config {
|
||||
self.opt.verbose
|
||||
}
|
||||
|
||||
pub fn tracing_filter_directives(&self) -> String {
|
||||
let mut ret = String::new();
|
||||
if let Some(directives) = self.config_file.misc.as_ref().and_then(|m| m.log_filters.as_ref()) {
|
||||
ret.push_str(&directives.join(","));
|
||||
}
|
||||
ret.push(',');
|
||||
ret.push_str(&self.opt.log_filter);
|
||||
if self.verbose() {
|
||||
ret.push_str(",debug");
|
||||
}
|
||||
ret
|
||||
}
|
||||
|
||||
pub fn show_skipped(&self) -> bool {
|
||||
self.opt.show_skipped
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user