Skip to content

Commit 3a2ed1f

Browse files
committed
add log_level to toml config
1 parent ec20a00 commit 3a2ed1f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
### Changed
1111

12+
- options can be set now with `svd2rust.toml` config
1213
- option `ignore_groups` for optional disabling #506
1314
- [breaking-change] move `const_generic` from features to options
1415
- use `Config` to pass options over all render levels

src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ fn run() -> Result<()> {
8585
))
8686
.get_matches();
8787

88-
setup_logging(&matches);
89-
9088
let xml = &mut String::new();
9189
match matches.value_of("input") {
9290
Some(file) => {
@@ -110,6 +108,8 @@ fn run() -> Result<()> {
110108

111109
let cfg = with_toml_env(&matches, &[config_filename, "svd2rust.toml"]);
112110

111+
setup_logging(&cfg);
112+
113113
let target = cfg
114114
.grab()
115115
.arg("target")
@@ -155,7 +155,7 @@ fn run() -> Result<()> {
155155
Ok(())
156156
}
157157

158-
fn setup_logging(matches: &clap::ArgMatches) {
158+
fn setup_logging<'a>(getter: &'a impl clap_conf::Getter<'a, String>) {
159159
// * Log at info by default.
160160
// * Allow users the option of setting complex logging filters using
161161
// env_logger's `RUST_LOG` environment variable.
@@ -170,7 +170,7 @@ fn setup_logging(matches: &clap::ArgMatches) {
170170
if log_lvl_from_env {
171171
log::set_max_level(log::LevelFilter::Trace);
172172
} else {
173-
let level = match matches.value_of("log_level") {
173+
let level = match getter.grab().arg("log_level").conf("log_level").done() {
174174
Some(lvl) => lvl.parse().unwrap(),
175175
None => log::LevelFilter::Info,
176176
};

0 commit comments

Comments
 (0)