mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-16 01:57:07 +00:00
chore(log): Add context to logger failure messages (#1764)
Have added a little bit more context to the error messages that occur when if starship is unable to setup the logger. This should hopefully make it a bit easier to work out why starship can't setup the logger.
This commit is contained in:
parent
205fd1abdd
commit
b2a5c4a3e4
@ -25,7 +25,8 @@ impl StarshipLogger {
|
||||
.join(".cache/starship")
|
||||
});
|
||||
|
||||
fs::create_dir_all(&log_dir).expect("Unable to create log dir!");
|
||||
fs::create_dir_all(&log_dir)
|
||||
.unwrap_or_else(|err| panic!("Unable to create log dir {:?}: {:?}!", log_dir, err));
|
||||
let session_log_file = log_dir.join(format!(
|
||||
"session_{}.log",
|
||||
env::var("STARSHIP_SESSION_KEY").unwrap_or_default()
|
||||
@ -43,8 +44,13 @@ impl StarshipLogger {
|
||||
OpenOptions::new()
|
||||
.create(true)
|
||||
.append(true)
|
||||
.open(session_log_file)
|
||||
.unwrap(),
|
||||
.open(session_log_file.clone())
|
||||
.unwrap_or_else(|err| {
|
||||
panic!(
|
||||
"Unable to open session log file {:?}: {:?}!",
|
||||
session_log_file, err
|
||||
)
|
||||
}),
|
||||
)),
|
||||
log_level: env::var("STARSHIP_LOG")
|
||||
.map(|level| match level.to_lowercase().as_str() {
|
||||
|
Loading…
Reference in New Issue
Block a user