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 files get 0o666 minus the umask, as
before 2.1. 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 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.