Feature Request
AFAIK it isn't currently possible to create a file appender without using non_blocking as with_target takes MakeWriter, which RollingFileAppender does not implement.
ex.
let appender = tracing_appender::rolling::never("", "log");
let fmt = fmt::layer()
.with_writer(appender);
returns:
error[E0277]: expected a `Fn<()>` closure, found `RollingFileAppender`
--> bin/src/logs.rs:31:40
|
31 | let fmt = fmt::layer().with_writer(appender);
| ^^^^^^^^ expected an `Fn<()>` closure, found `RollingFileAppender`
|
= help: the trait `Fn<()>` is not implemented for `RollingFileAppender`
= note: wrap the `RollingFileAppender` in a closure with no arguments: `|| { /* code */ }`
= note: required because of the requirements on the impl of `MakeWriter` for `RollingFileAppender`
the suggestion to wrap in a closure does not work either as the closure will be FnOnce instead of Fn
Crates
tracing_appender?
Motivation
see above
Proposal
Maybe create a blocking function that wraps RollingFileAppender in an Arc<Mutex<>> or something like that so the clones are cheaper?
I'm happy to submit a PR for this if you could give some direction on what would be the best way to solve.
Feature Request
AFAIK it isn't currently possible to create a file appender without using
non_blockingaswith_targettakesMakeWriter, whichRollingFileAppenderdoes not implement.ex.
returns:
the suggestion to wrap in a closure does not work either as the closure will be
FnOnceinstead ofFnCrates
tracing_appender?
Motivation
see above
Proposal
Maybe create a
blockingfunction that wrapsRollingFileAppenderin anArc<Mutex<>>or something like that so the clones are cheaper?I'm happy to submit a PR for this if you could give some direction on what would be the best way to solve.