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:
parent
7745e54221
commit
9b4fd3bf57
@ -8,6 +8,7 @@ use tracing_appender::rolling::Rotation;
|
||||
use tracing_appender::{non_blocking::WorkerGuard, rolling::RollingFileAppender};
|
||||
use tracing_bunyan_formatter::JsonStorageLayer;
|
||||
use tracing_subscriber::fmt::format::Writer;
|
||||
use tracing_subscriber::fmt::MakeWriter;
|
||||
use tracing_subscriber::{layer::SubscriberExt, EnvFilter};
|
||||
|
||||
use crate::layer::FlowyFormattingLayer;
|
||||
@ -87,6 +88,7 @@ impl Builder {
|
||||
.pretty()
|
||||
.with_env_filter(env_filter)
|
||||
.finish()
|
||||
.with(FlowyFormattingLayer::new(StdoutWriter))
|
||||
.with(JsonStorageLayer)
|
||||
.with(file_layer);
|
||||
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"))
|
||||
}
|
||||
}
|
||||
|
||||
pub struct StdoutWriter;
|
||||
|
||||
impl<'a> MakeWriter<'a> for StdoutWriter {
|
||||
type Writer = std::io::Stdout;
|
||||
|
||||
fn make_writer(&'a self) -> Self::Writer {
|
||||
std::io::stdout()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user