Struct argmin::core::observers::slog_logger::SlogLogger
source · [−]pub struct SlogLogger { /* private fields */ }
Expand description
A logger using the slog
crate as backend.
Implementations
sourceimpl SlogLogger
impl SlogLogger
sourcepub fn term() -> Self
pub fn term() -> Self
Log to the terminal.
Will block execution when buffer is full.
Example
use argmin::core::observers::SlogLogger;
let terminal_logger = SlogLogger::term();
sourcepub fn term_noblock() -> Self
pub fn term_noblock() -> Self
Log to the terminal without blocking execution.
Messages may be lost in case of buffer overflow.
Example
use argmin::core::observers::SlogLogger;
let terminal_logger = SlogLogger::term_noblock();
sourcepub fn file<N: AsRef<str>>(file: N, truncate: bool) -> Result<Self, Error>
pub fn file<N: AsRef<str>>(file: N, truncate: bool) -> Result<Self, Error>
Log JSON to a file while blocking execution in case of full buffers.
If truncate
is set to true
, the content of existing log files will be cleared.
Only available if the serde1
feature is set.
Example
use argmin::core::observers::SlogLogger;
let file_logger = SlogLogger::file("logfile.log", true);
sourcepub fn file_noblock<N: AsRef<str>>(
file: N,
truncate: bool
) -> Result<Self, Error>
pub fn file_noblock<N: AsRef<str>>(
file: N,
truncate: bool
) -> Result<Self, Error>
Log JSON to a file without blocking execution.
Messages may be lost in case of buffer overflow.
If truncate
is set to true
, the content of existing log files will be cleared.
Only available if the serde1
feature is set.
Example
use argmin::core::observers::SlogLogger;
let file_logger = SlogLogger::file_noblock("logfile.log", true);
Trait Implementations
sourceimpl Clone for SlogLogger
impl Clone for SlogLogger
sourcefn clone(&self) -> SlogLogger
fn clone(&self) -> SlogLogger
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<I> Observe<I> for SlogLogger where
I: State,
impl<I> Observe<I> for SlogLogger where
I: State,
Auto Trait Implementations
impl RefUnwindSafe for SlogLogger
impl Send for SlogLogger
impl Sync for SlogLogger
impl Unpin for SlogLogger
impl UnwindSafe for SlogLogger
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more