I'm setting up tracing like this:
fn init_tracing() -> WorkerGuard {
let appender = RollingFileAppender::builder()
.rotation(Rotation::DAILY)
.filename_prefix("server.log")
.build("./log")
.expect("failed to initialize tracing");
let (non_blocking, guard) = tracing_appender::non_blocking(appender);
tracing_subscriber::fmt()
.with_file(true)
.with_thread_ids(true)
.with_target(false)
.with_writer(non_blocking)
.init();
guard
}
I'd love to be able to have two RollingFileAppenders, one at Info level and one at Trace (if you've done production support you know why). Surprisingly there seems to be no obvious way to do this.
I'd settle for one RollingFileAppender and another just to stdout (which I'd redirect).