Skip to main content

RotatingFileBuilder

Struct RotatingFileBuilder 

Source
pub struct RotatingFileBuilder { /* private fields */ }
Available on crate feature std only.
Expand description

Options for a RotatingFile. Create with RotatingFile::builder.

Implementations§

Source§

impl RotatingFileBuilder

Source

pub const fn max_bytes(self, bytes: u64) -> Self

Rotate before a write would take the active file past bytes.

Source

pub const fn rotation(self, rotation: Rotation) -> Self

Rotate on a UTC time schedule.

Source

pub const fn max_files(self, count: usize) -> Self

How many rotated files to keep (<path>.1 ..= <path>.N). 0 keeps none.

Source

pub const fn buffer_capacity(self, bytes: usize) -> Self

Size of the in-memory write buffer (0 = unbuffered).

Source

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()?;
Source

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.

Trait Implementations§

Source§

impl Clone for RotatingFileBuilder

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RotatingFileBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.