file logging seems to work except non-blocking
This commit is contained in:
parent
7987e13b2a
commit
8a6965a24f
1 changed files with 3 additions and 7 deletions
|
|
@ -1,11 +1,9 @@
|
||||||
use super::util::VAR_LOG;
|
use super::util::VAR_LOG;
|
||||||
use tracing::subscriber::set_global_default;
|
|
||||||
use tracing::Level;
|
use tracing::Level;
|
||||||
use tracing_appender::{
|
use tracing_appender::{
|
||||||
non_blocking,
|
non_blocking,
|
||||||
rolling::{RollingFileAppender, Rotation},
|
rolling::{RollingFileAppender, Rotation},
|
||||||
};
|
};
|
||||||
use tracing_subscriber::layer::SubscriberExt;
|
|
||||||
use tracing_subscriber::fmt;
|
use tracing_subscriber::fmt;
|
||||||
|
|
||||||
pub fn log_init() {
|
pub fn log_init() {
|
||||||
|
|
@ -16,14 +14,12 @@ pub fn log_init() {
|
||||||
.build(VAR_LOG)
|
.build(VAR_LOG)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let (non_blocking, guard) = non_blocking(file_appender);
|
//let (non_blocking, _guard) = non_blocking(file_appender);
|
||||||
let file_layer = fmt::layer().with_ansi(true).with_writer(non_blocking);
|
|
||||||
|
|
||||||
let subscriber = fmt()
|
let subscriber = fmt()
|
||||||
|
.with_writer(file_appender)
|
||||||
.with_ansi(true)
|
.with_ansi(true)
|
||||||
.with_max_level(Level::TRACE)
|
.with_max_level(Level::TRACE)
|
||||||
.pretty()
|
.pretty()
|
||||||
.finish()
|
.init();
|
||||||
.with(file_layer);
|
|
||||||
set_global_default(subscriber).expect("set_global_default subscriber");
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue