fix: af cloud sync auth (#3873)

* feat: open workspace

* chore: update env docs

* fix: invalid user callback

* fix: token invalid

* chore: update

* chore: update

* chore: update

* chore: fix test

* chore: fix tauri build
This commit is contained in:
Nathan.fooo
2023-11-05 14:00:24 +08:00
committed by GitHub
parent b35d6131d4
commit 1025b6d553
59 changed files with 658 additions and 478 deletions

View File

@ -7,7 +7,6 @@ edition = "2018"
[dependencies]
tracing-log = { version = "0.2"}
tracing-subscriber = { version = "0.3.17", features = ["registry", "env-filter", "ansi", "json"] }
tracing-bunyan-formatter = "0.3.9"
tracing-appender = "0.2.2"

View File

@ -1,9 +1,11 @@
use std::sync::RwLock;
use chrono::Local;
use lazy_static::lazy_static;
use tracing::subscriber::set_global_default;
use tracing_appender::{non_blocking::WorkerGuard, rolling::RollingFileAppender};
use tracing_bunyan_formatter::JsonStorageLayer;
use tracing_subscriber::fmt::format::Writer;
use tracing_subscriber::{layer::SubscriberExt, EnvFilter};
use crate::layer::FlowyFormattingLayer;
@ -43,12 +45,12 @@ impl Builder {
let (non_blocking, guard) = tracing_appender::non_blocking(self.file_appender);
let subscriber = tracing_subscriber::fmt()
.with_timer(CustomTime)
.with_ansi(true)
.with_target(true)
.with_target(false)
.with_max_level(tracing::Level::TRACE)
.with_thread_ids(false)
.with_file(false)
.with_writer(std::io::stderr)
.with_writer(std::io::stdout)
.pretty()
.with_env_filter(env_filter)
.finish()
@ -56,7 +58,15 @@ impl Builder {
.with(FlowyFormattingLayer::new(non_blocking));
set_global_default(subscriber).map_err(|e| format!("{:?}", e))?;
*LOG_GUARD.write().unwrap() = Some(guard);
Ok(())
}
}
struct CustomTime;
impl tracing_subscriber::fmt::time::FormatTime for CustomTime {
fn format_time(&self, w: &mut Writer<'_>) -> std::fmt::Result {
write!(w, "{}", Local::now().format("%Y-%m-%d %H:%M:%S"))
}
}