pub struct AsyncPoolSinkBuilder { /* private fields */ }Implementations§
Source§impl AsyncPoolSinkBuilder
impl AsyncPoolSinkBuilder
Sourcepub fn sink(self, sink: Arc<dyn Sink>) -> Self
Available on crate feature multi-thread only.
pub fn sink(self, sink: Arc<dyn Sink>) -> Self
multi-thread only.Add a Sink.
Examples found in repository?
examples/07-async.rs (line 13)
8fn main() -> Result<(), Box<dyn std::error::Error>> {
9 let path = env::current_exe()?.with_file_name("async.log");
10 let file_sink = FileSink::builder().path(path).build_arc()?;
11
12 // AsyncPoolSink is a combined sink which wraps other sinks
13 let async_pool_sink = AsyncPoolSink::builder().sink(file_sink).build_arc()?;
14
15 let async_logger = Logger::builder()
16 .sink(async_pool_sink)
17 .flush_level_filter(LevelFilter::All)
18 .build_arc()?;
19
20 info!(logger: async_logger, "Hello, async!");
21
22 Ok(())
23}Sourcepub fn sinks<I>(self, sinks: I) -> Self
Available on crate feature multi-thread only.
pub fn sinks<I>(self, sinks: I) -> Self
multi-thread only.Add multiple Sinks.
Sourcepub fn overflow_policy(self, overflow_policy: OverflowPolicy) -> Self
Available on crate feature multi-thread only.
pub fn overflow_policy(self, overflow_policy: OverflowPolicy) -> Self
multi-thread only.Specifies a overflow policy.
This parameter is optional, and defaults to
OverflowPolicy::Block.
When the channel is full, an incoming operation is handled according to the specified policy.
Sourcepub fn thread_pool(self, thread_pool: Arc<ThreadPool>) -> Self
Available on crate feature multi-thread only.
pub fn thread_pool(self, thread_pool: Arc<ThreadPool>) -> Self
multi-thread only.Specifies a custom thread pool.
This parameter is optional, and defaults to the internal shared default thread pool.
Sourcepub fn level_filter(self, level_filter: LevelFilter) -> Self
Available on crate feature multi-thread only.
pub fn level_filter(self, level_filter: LevelFilter) -> Self
multi-thread only.Specifies a log level filter.
This parameter is optional, and defaults to LevelFilter::All.
Sourcepub fn error_handler<F: Into<ErrorHandler>>(self, handler: F) -> Self
Available on crate feature multi-thread only.
pub fn error_handler<F: Into<ErrorHandler>>(self, handler: F) -> Self
multi-thread only.Specifies an error handler.
This parameter is optional, and defaults to
ErrorHandler::default().
Sourcepub fn build(self) -> Result<AsyncPoolSink>
Available on crate feature multi-thread only.
pub fn build(self) -> Result<AsyncPoolSink>
multi-thread only.Builds a AsyncPoolSink.
Sourcepub fn build_arc(self) -> Result<Arc<AsyncPoolSink>>
Available on crate feature multi-thread only.
pub fn build_arc(self) -> Result<Arc<AsyncPoolSink>>
multi-thread only.Builds a Arc<AsyncPoolSink>.
This is a shorthand method for .build().map(Arc::new).
Examples found in repository?
examples/07-async.rs (line 13)
8fn main() -> Result<(), Box<dyn std::error::Error>> {
9 let path = env::current_exe()?.with_file_name("async.log");
10 let file_sink = FileSink::builder().path(path).build_arc()?;
11
12 // AsyncPoolSink is a combined sink which wraps other sinks
13 let async_pool_sink = AsyncPoolSink::builder().sink(file_sink).build_arc()?;
14
15 let async_logger = Logger::builder()
16 .sink(async_pool_sink)
17 .flush_level_filter(LevelFilter::All)
18 .build_arc()?;
19
20 info!(logger: async_logger, "Hello, async!");
21
22 Ok(())
23}Auto Trait Implementations§
impl !Freeze for AsyncPoolSinkBuilder
impl !RefUnwindSafe for AsyncPoolSinkBuilder
impl Send for AsyncPoolSinkBuilder
impl Sync for AsyncPoolSinkBuilder
impl Unpin for AsyncPoolSinkBuilder
impl !UnwindSafe for AsyncPoolSinkBuilder
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more