pub struct StdStreamSink { /* private fields */ }
Expand description
A sink with a std stream as the target.
It writes styled text or plain text according to the given StyleMode
and
the current terminal environment.
Note that this sink always flushes the buffer once with each logging.
Implementations§
Source§impl StdStreamSink
impl StdStreamSink
Sourcepub fn builder() -> StdStreamSinkBuilder<()>
pub fn builder() -> StdStreamSinkBuilder<()>
Gets a builder of StdStreamSink
with default parameters:
Parameter | Default Value |
---|---|
level_filter | All |
formatter | FullFormatter |
error_handler | default error handler |
std_stream | must be specified |
style_mode | Auto |
Sourcepub fn new(std_stream: StdStream, style_mode: StyleMode) -> StdStreamSink
👎Deprecated since 0.3.0: it may be removed in the future, use StdStreamSink::builder()
instead
pub fn new(std_stream: StdStream, style_mode: StyleMode) -> StdStreamSink
StdStreamSink::builder()
insteadConstructs a StdStreamSink
.
Sourcepub fn set_style(&mut self, level: Level, style: Style)
pub fn set_style(&mut self, level: Level, style: Style)
Sets the style of the specified log level.
Sourcepub fn set_style_mode(&mut self, style_mode: StyleMode)
pub fn set_style_mode(&mut self, style_mode: StyleMode)
Sets the style mode.
Trait Implementations§
Source§impl Sink for StdStreamSink
impl Sink for StdStreamSink
Source§fn level_filter(&self) -> LevelFilter
fn level_filter(&self) -> LevelFilter
Gets the log level filter.
Source§fn set_level_filter(&self, level_filter: LevelFilter)
fn set_level_filter(&self, level_filter: LevelFilter)
Sets the log level filter.
Source§fn set_formatter(&self, formatter: Box<dyn Formatter>)
fn set_formatter(&self, formatter: Box<dyn Formatter>)
Sets the formatter.
Source§fn set_error_handler(&self, handler: Option<ErrorHandler>)
fn set_error_handler(&self, handler: Option<ErrorHandler>)
Sets a error handler. Read more
Source§fn should_log(&self, level: Level) -> bool
fn should_log(&self, level: Level) -> bool
Determines if a log message with the specified level would be logged.
Auto Trait Implementations§
impl !Freeze for StdStreamSink
impl !RefUnwindSafe for StdStreamSink
impl Send for StdStreamSink
impl Sync for StdStreamSink
impl Unpin for StdStreamSink
impl !UnwindSafe for StdStreamSink
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more