Display changes
This commit is contained in:
parent
f0c6e38403
commit
b20148c73a
1 changed files with 7 additions and 11 deletions
18
src/main.rs
18
src/main.rs
|
@ -454,7 +454,7 @@ fn load_config(user_provided_path: Option<PathBuf>) -> Option<Config> {
|
||||||
let maybe_config = load_config_from_path(&path);
|
let maybe_config = load_config_from_path(&path);
|
||||||
if maybe_config.is_some() {
|
if maybe_config.is_some() {
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
path = %path.to_string_lossy(),
|
path = %path.display(),
|
||||||
"Loaded config file"
|
"Loaded config file"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -466,7 +466,7 @@ fn load_config(user_provided_path: Option<PathBuf>) -> Option<Config> {
|
||||||
let resolved_path = resolved_path.as_deref().unwrap_or(file_path);
|
let resolved_path = resolved_path.as_deref().unwrap_or(file_path);
|
||||||
if let Some(config) = load_config_from_path(resolved_path) {
|
if let Some(config) = load_config_from_path(resolved_path) {
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
path = %resolved_path.to_string_lossy(),
|
path = %resolved_path.display(),
|
||||||
"Loaded config file"
|
"Loaded config file"
|
||||||
);
|
);
|
||||||
return Some(config);
|
return Some(config);
|
||||||
|
@ -477,7 +477,7 @@ fn load_config(user_provided_path: Option<PathBuf>) -> Option<Config> {
|
||||||
.and_then(|path| load_config_from_path(&path).map(|conf| (path, conf)))
|
.and_then(|path| load_config_from_path(&path).map(|conf| (path, conf)))
|
||||||
{
|
{
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
path = %path.to_string_lossy(),
|
path = %path.display(),
|
||||||
"Loaded config file"
|
"Loaded config file"
|
||||||
);
|
);
|
||||||
return Some(config);
|
return Some(config);
|
||||||
|
@ -492,22 +492,18 @@ fn load_config(user_provided_path: Option<PathBuf>) -> Option<Config> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_config_from_path<P: AsRef<Path>>(path: P) -> Option<Config> {
|
fn load_config_from_path<P: AsRef<Path>>(path: P) -> Option<Config> {
|
||||||
|
let path = path.as_ref();
|
||||||
match std::fs::read_to_string(&path) {
|
match std::fs::read_to_string(&path) {
|
||||||
Ok(data) => match toml::from_str(&data) {
|
Ok(data) => match toml::from_str(&data) {
|
||||||
Ok(config) => return Some(config),
|
Ok(config) => return Some(config),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
debug!(
|
debug!(path = %path.display(), "Failed to parse config file: {err}");
|
||||||
"Failed to parse config file at {}: {}",
|
|
||||||
path.as_ref().to_string_lossy(),
|
|
||||||
err
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
debug!(
|
debug!(
|
||||||
"Unable to read the config file at {}: {}",
|
path = %path.display(),
|
||||||
path.as_ref().to_string_lossy(),
|
"Unable to read the config file: {err}",
|
||||||
err
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue