Struct Logger

Source
pub struct Logger {
    pub logging_opts: LoggingOpts,
    pub local_time_default: bool,
    pub timestamp_opts: TimestampOpts,
    pub dir_path: Arc<Path>,
}

Fields§

§logging_opts: LoggingOpts§local_time_default: bool

What the default should be if logging_opts does not specify a local_time setting (or specifies both ambiguously)

§timestamp_opts: TimestampOpts§dir_path: Arc<Path>

Implementations§

Source§

impl Logger

Source

pub fn current_log_path(&self) -> PathBuf

Source

pub fn rotate_logs(&self) -> Result<()>

Rename the “current.log” file (if present) to “000001.log” or similar, allocating a new number, and delete old log files if there are more than configured.

Source

pub fn redirect_to_logger(self, session_pid: Pid) -> Result<(), DaemonError>

Fork off a logger process (it immediately starts a new unix session to avoid being killed when the parent process group is killed) and redirect stdout and stderr to it. session_pid is denoting the daemon instance (the parent process or rather process group), it is written to the log when the parent ends (or closes stderr and stdout). Make sure stdout and stderr are flushed before calling this method.

Auto Trait Implementations§

§

impl Freeze for Logger

§

impl RefUnwindSafe for Logger

§

impl Send for Logger

§

impl Sync for Logger

§

impl Unpin for Logger

§

impl UnwindSafe for Logger

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.