feat: blocking appender for rolling file and syslog#111
Conversation
| Ok(()) | ||
| } | ||
|
|
||
| fn flush(&self) { |
There was a problem hiding this comment.
@andylokandy maybe flush should return anyhow::Result<()> and we handle error all at one level up:
fn log(&self, record: &Record) {
for dispatch in &self.dispatches {
if let Err(err) = dispatch.log(record) {
handle_error(record, err);
}
}
}
fn flush(&self) {
for dispatch in &self.dispatches {
if let Err(err) = dispatch.flush() {
handle_flush_error(err);
}
}
}also maybe add a ErrorSink trait for custom error listener.
There was a problem hiding this comment.
I think we can keep the behavior in sync with non-blocking its variant. is the non blocking one return result on flush?
There was a problem hiding this comment.
The non-blocking one do flush in the worker thread where the error is handled as eprintln!("failed to write log: {err}");.
Signed-off-by: tison <wander4096@gmail.com>
1e56fc8 to
570cf0b
Compare
Signed-off-by: tison <wander4096@gmail.com>
570cf0b to
bff61e0
Compare
|
I'm curious why |
|
Sound reasonable. I'll take some time to play with it. |
This closes #96