pub struct RotatingFileBuilder { /* private fields */ }std only.Expand description
Options for a RotatingFile. Create with RotatingFile::builder.
Implementations§
Source§impl RotatingFileBuilder
impl RotatingFileBuilder
Sourcepub const fn max_bytes(self, bytes: u64) -> Self
pub const fn max_bytes(self, bytes: u64) -> Self
Rotate before a write would take the active file past bytes.
Sourcepub const fn max_files(self, count: usize) -> Self
pub const fn max_files(self, count: usize) -> Self
How many rotated files to keep (<path>.1 ..= <path>.N).
0 keeps none.
Sourcepub const fn buffer_capacity(self, bytes: usize) -> Self
pub const fn buffer_capacity(self, bytes: usize) -> Self
Size of the in-memory write buffer (0 = unbuffered).
Sourcepub const fn mode(self, mode: u32) -> Self
pub const fn mode(self, mode: u32) -> Self
Unix permission bits for every file this writer creates: the active
file and each new one after a rotation, such as 0o600 or 0o640.
The process umask still applies, and an existing file keeps its
mode. Without this call new files get 0o600 (since 2.2; logs
often carry tokens and personal data). Use .mode(0o644) for the
earlier behaviour (0o666 minus the usual umask). On Windows files
inherit their directory’s access control list and the mode has no
effect.
§Examples
use log_io::sink::{RotatingFile, Rotation};
let file = RotatingFile::builder("app.log")
.rotation(Rotation::Daily)
.mode(0o640)
.open()?;Sourcepub const fn follow_symlinks(self, follow: bool) -> Self
pub const fn follow_symlinks(self, follow: bool) -> Self
Allow the path to be a symbolic link (true). Default false
(since 2.2): opening, and reopening after every rotation, fails
when the path is a symbolic link (on Windows any reparse point) or
not a regular file, so a link planted in a shared log directory
between rotations cannot redirect log lines into another file. A
failed reopen is reported like any rotation error.
Sourcepub fn open(self) -> Result<RotatingFile>
pub fn open(self) -> Result<RotatingFile>
Open (or create) the active file in append mode.
If the file already exists and was last modified in an earlier period of the time schedule, it is rotated on the first write.
§Errors
Returns the I/O error from opening the file.