Open a log file with proper options for append-only writing. Creates parent directories if they don't exist.
(path: &PathBuf)
| 233 | /// |
| 234 | /// Creates parent directories if they don't exist. |
| 235 | fn open_log_file(path: &PathBuf) -> io::Result<File> { |
| 236 | if let Some(parent) = path.parent() { |
| 237 | fs::create_dir_all(parent)?; |
| 238 | } |
| 239 | OpenOptions::new().create(true).append(true).open(path) |
| 240 | } |
| 241 | |
| 242 | /// Write a single log entry to the file, followed by a flush. |
| 243 | /// |