mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: update log
This commit is contained in:
@ -8,6 +8,7 @@ use tracing_appender::rolling::Rotation;
|
|||||||
use tracing_appender::{non_blocking::WorkerGuard, rolling::RollingFileAppender};
|
use tracing_appender::{non_blocking::WorkerGuard, rolling::RollingFileAppender};
|
||||||
use tracing_bunyan_formatter::JsonStorageLayer;
|
use tracing_bunyan_formatter::JsonStorageLayer;
|
||||||
use tracing_subscriber::fmt::format::Writer;
|
use tracing_subscriber::fmt::format::Writer;
|
||||||
|
use tracing_subscriber::fmt::MakeWriter;
|
||||||
use tracing_subscriber::{layer::SubscriberExt, EnvFilter};
|
use tracing_subscriber::{layer::SubscriberExt, EnvFilter};
|
||||||
|
|
||||||
use crate::layer::FlowyFormattingLayer;
|
use crate::layer::FlowyFormattingLayer;
|
||||||
@ -87,6 +88,7 @@ impl Builder {
|
|||||||
.pretty()
|
.pretty()
|
||||||
.with_env_filter(env_filter)
|
.with_env_filter(env_filter)
|
||||||
.finish()
|
.finish()
|
||||||
|
.with(FlowyFormattingLayer::new(StdoutWriter))
|
||||||
.with(JsonStorageLayer)
|
.with(JsonStorageLayer)
|
||||||
.with(file_layer);
|
.with(file_layer);
|
||||||
set_global_default(subscriber).map_err(|e| format!("{:?}", e))?;
|
set_global_default(subscriber).map_err(|e| format!("{:?}", e))?;
|
||||||
@ -103,3 +105,13 @@ impl tracing_subscriber::fmt::time::FormatTime for CustomTime {
|
|||||||
write!(w, "{}", Local::now().format("%Y-%m-%d %H:%M:%S"))
|
write!(w, "{}", Local::now().format("%Y-%m-%d %H:%M:%S"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct StdoutWriter;
|
||||||
|
|
||||||
|
impl<'a> MakeWriter<'a> for StdoutWriter {
|
||||||
|
type Writer = std::io::Stdout;
|
||||||
|
|
||||||
|
fn make_writer(&'a self) -> Self::Writer {
|
||||||
|
std::io::stdout()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user