Skip to content

Commit f033ba2

Browse files
committed
refactor: return error when creating logger directory
1 parent 8c55876 commit f033ba2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/logger.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ impl FilesystemLogger {
2525
/// Creates a new filesystem logger given the path to the log file and the log level.
2626
pub(crate) fn new(log_file_path: String, level: Level) -> Result<Self, ()> {
2727
if let Some(parent_dir) = Path::new(&log_file_path).parent() {
28-
fs::create_dir_all(parent_dir).expect("Failed to create log parent directory");
28+
fs::create_dir_all(parent_dir)
29+
.map_err(|e| eprintln!("ERROR: Failed to create log parent directory: {}", e))?;
2930

3031
// make sure the file exists.
3132
fs::OpenOptions::new()

0 commit comments

Comments
 (0)