fix: 040 bugs (#4285)

* test: add tests

* chore: set maximum log files

* fix: import row document

* chore: bump client api

* chore: fix analyzer

* chore: fix flutter unit test
This commit is contained in:
Nathan.fooo
2024-01-03 11:41:29 +08:00
committed by GitHub
parent eef5c2bf66
commit 7937fd1f3a
35 changed files with 537 additions and 280 deletions

View File

@ -9,7 +9,7 @@ edition = "2018"
tracing-subscriber = { version = "0.3.17", features = ["registry", "env-filter", "ansi", "json"] }
tracing-bunyan-formatter = "0.3.9"
tracing-appender = "0.2.2"
tracing-appender = "0.2.3"
tracing-core = "0.1"
tracing.workspace = true
serde_json.workspace = true

View File

@ -3,6 +3,7 @@ use std::sync::RwLock;
use chrono::Local;
use lazy_static::lazy_static;
use tracing::subscriber::set_global_default;
use tracing_appender::rolling::Rotation;
use tracing_appender::{non_blocking::WorkerGuard, rolling::RollingFileAppender};
use tracing_bunyan_formatter::JsonStorageLayer;
use tracing_subscriber::fmt::format::Writer;
@ -25,10 +26,17 @@ pub struct Builder {
impl Builder {
pub fn new(name: &str, directory: &str) -> Self {
let file_appender = RollingFileAppender::builder()
.rotation(Rotation::DAILY)
.filename_prefix(name)
.max_log_files(6)
.build(directory)
.unwrap_or(tracing_appender::rolling::daily(directory, name));
Builder {
name: name.to_owned(),
env_filter: "Info".to_owned(),
file_appender: tracing_appender::rolling::daily(directory, name),
file_appender,
}
}