mirror of
https://github.com/starship/starship.git
synced 2026-06-24 02:01:36 +07:00
feat: add error messaging (#1576)
This creates a custom logger for the log crate which logs everything to a file (/tmp/starship/session_$STARSHIP_SESSION_KEY.log) and it logs everything above Warn to stderr, but only if the log file does not contain the line that should be logged resulting in an error or warning to be only logged at the first starship invocation after opening the shell.
This commit is contained in:
@@ -144,7 +144,7 @@ impl<'a> GitStatusInfo<'a> {
|
||||
return match result.as_ref() {
|
||||
Ok(ahead_behind) => Some(*ahead_behind),
|
||||
Err(error) => {
|
||||
log::warn!("Warn: get_ahead_behind: {}", error);
|
||||
log::debug!("get_ahead_behind: {}", error);
|
||||
None
|
||||
}
|
||||
};
|
||||
@@ -159,7 +159,7 @@ impl<'a> GitStatusInfo<'a> {
|
||||
match data.as_ref().unwrap() {
|
||||
Ok(ahead_behind) => Some(*ahead_behind),
|
||||
Err(error) => {
|
||||
log::warn!("Warn: get_ahead_behind: {}", error);
|
||||
log::debug!("get_ahead_behind: {}", error);
|
||||
None
|
||||
}
|
||||
}
|
||||
@@ -173,7 +173,7 @@ impl<'a> GitStatusInfo<'a> {
|
||||
return match result.as_ref() {
|
||||
Ok(repo_status) => Some(*repo_status),
|
||||
Err(error) => {
|
||||
log::warn!("Warn: get_repo_status: {}", error);
|
||||
log::debug!("get_repo_status: {}", error);
|
||||
None
|
||||
}
|
||||
};
|
||||
@@ -187,7 +187,7 @@ impl<'a> GitStatusInfo<'a> {
|
||||
match data.as_ref().unwrap() {
|
||||
Ok(repo_status) => Some(*repo_status),
|
||||
Err(error) => {
|
||||
log::warn!("Warn: get_repo_status: {}", error);
|
||||
log::debug!(" get_repo_status: {}", error);
|
||||
None
|
||||
}
|
||||
}
|
||||
@@ -201,7 +201,7 @@ impl<'a> GitStatusInfo<'a> {
|
||||
return match result.as_ref() {
|
||||
Ok(stashed_count) => Some(*stashed_count),
|
||||
Err(error) => {
|
||||
log::warn!("Warn: get_stashed_count: {}", error);
|
||||
log::debug!("get_stashed_count: {}", error);
|
||||
None
|
||||
}
|
||||
};
|
||||
@@ -215,7 +215,7 @@ impl<'a> GitStatusInfo<'a> {
|
||||
match data.as_ref().unwrap() {
|
||||
Ok(stashed_count) => Some(*stashed_count),
|
||||
Err(error) => {
|
||||
log::warn!("Warn: get_stashed_count: {}", error);
|
||||
log::debug!("get_stashed_count: {}", error);
|
||||
None
|
||||
}
|
||||
}
|
||||
@@ -356,7 +356,7 @@ where
|
||||
.parse(None)
|
||||
.ok()
|
||||
} else {
|
||||
log::error!("Error parsing format string `{}`", &config_path);
|
||||
log::warn!("Error parsing format string `{}`", &config_path);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user