chore: enable sync log by default

This commit is contained in:
Nathan 2025-04-07 22:04:32 +08:00
parent d74b0bf6e1
commit 71a6ba660f
4 changed files with 13 additions and 18 deletions

View file

@ -130,7 +130,7 @@ class CustomAppFlowyCloudView extends StatelessWidget {
final List<Widget> children = [];
children.addAll([
const AppFlowyCloudEnableSync(),
const AppFlowyCloudSyncLogEnabled(),
// const AppFlowyCloudSyncLogEnabled(),
const VSpace(40),
]);

View file

@ -84,14 +84,12 @@ impl AppFlowyCoreConfig {
) -> Self {
let cloud_config = AFCloudConfiguration::from_env().ok();
let mut log_crates = vec![];
// By default enable sync trace log
log_crates.push("sync_trace_log".to_string());
let storage_path = match &cloud_config {
None => custom_application_path,
Some(config) => {
if config.enable_sync_trace {
log_crates.push("sync_trace_log".to_string());
}
make_user_data_folder(&custom_application_path, &config.base_url)
},
Some(config) => make_user_data_folder(&custom_application_path, &config.base_url),
};
let log_filter = create_log_filter(

View file

@ -11,10 +11,6 @@ use collab_document::blocks::{
DocumentData,
};
use flowy_error::{FlowyError, FlowyResult};
use lib_dispatch::prelude::{data_result_ok, AFPluginData, AFPluginState, DataResult};
use tracing::instrument;
use crate::entities::*;
use crate::parser::document_data_parser::DocumentDataParser;
use crate::parser::external::parser::ExternalDataToNestedJSONParser;
@ -23,6 +19,10 @@ use crate::parser::parser_entities::{
ConvertDocumentParams, ConvertDocumentPayloadPB, ConvertDocumentResponsePB,
};
use crate::{manager::DocumentManager, parser::json::parser::JsonToDocumentParser};
use flowy_error::{FlowyError, FlowyResult};
use lib_dispatch::prelude::{data_result_ok, AFPluginData, AFPluginState, DataResult};
use lib_infra::sync_trace;
use tracing::instrument;
fn upgrade_document(
document_manager: AFPluginState<Weak<DocumentManager>>,
@ -124,9 +124,7 @@ pub(crate) async fn apply_action_handler(
let doc_id = params.document_id;
let document = manager.editable_document(&doc_id).await?;
let actions = params.actions;
if cfg!(feature = "verbose_log") {
tracing::trace!("{} applying actions: {:?}", doc_id, actions);
}
sync_trace!("{} applying action: {:?}", doc_id, actions);
document.write().await.apply_action(actions)?;
Ok(())
}
@ -141,6 +139,7 @@ pub(crate) async fn create_text_handler(
let doc_id = params.document_id;
let document = manager.editable_document(&doc_id).await?;
let mut document = document.write().await;
sync_trace!("{} creating text: {:?}", doc_id, params.delta);
document.apply_text_delta(&params.text_id, params.delta);
Ok(())
}
@ -157,9 +156,7 @@ pub(crate) async fn apply_text_delta_handler(
let text_id = params.text_id;
let delta = params.delta;
let mut document = document.write().await;
if cfg!(feature = "verbose_log") {
tracing::trace!("{} applying delta: {:?}", doc_id, delta);
}
sync_trace!("{} applying delta: {:?}", doc_id, delta);
document.apply_text_delta(&text_id, delta);
Ok(())
}

View file

@ -60,7 +60,7 @@ impl AFCloudConfiguration {
let enable_sync_trace = std::env::var(APPFLOWY_ENABLE_SYNC_TRACE)
.map(|v| v == "true" || v == "1")
.unwrap_or(false);
.unwrap_or(true);
Ok(Self {
base_url,