| 295 | } |
| 296 | |
| 297 | fn open_file(dir: &Path) -> Result<RollingFileAppender, OpenError> { |
| 298 | if !dir.is_absolute() { |
| 299 | return Err(OpenError::Relative); |
| 300 | } |
| 301 | create_private_dir(dir).map_err(OpenError::Create)?; |
| 302 | RollingFileAppender::builder() |
| 303 | .rotation(Rotation::DAILY) |
| 304 | .filename_prefix(LOG_FILE_PREFIX) |
| 305 | .filename_suffix(LOG_FILE_SUFFIX) |
| 306 | .build(dir) |
| 307 | .map_err(OpenError::Init) |
| 308 | } |
| 309 | |
| 310 | /// Create the log directory readable by its owner only: the file records |
| 311 | /// working directories, paths and error text. An existing directory keeps |