diff --git a/frontend/Makefile.toml b/frontend/Makefile.toml index 4b1c4f9367..9f3d9ea57f 100644 --- a/frontend/Makefile.toml +++ b/frontend/Makefile.toml @@ -10,6 +10,7 @@ extend = [ ] [env] +RUST_LOG = "info" CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true CARGO_MAKE_CRATE_FS_NAME = "dart_ffi" CARGO_MAKE_CRATE_NAME = "dart-ffi" @@ -22,6 +23,7 @@ SDK_EXT = "a" APP_ENVIRONMENT = "local" [env.development-mac] +RUST_LOG = "trace" TARGET_OS = "macos" RUST_COMPILE_TARGET = "x86_64-apple-darwin" BUILD_FLAG = "debug" diff --git a/frontend/app_flowy/.vscode/launch.json b/frontend/app_flowy/.vscode/launch.json index d0b93e3b54..c7236062fd 100644 --- a/frontend/app_flowy/.vscode/launch.json +++ b/frontend/app_flowy/.vscode/launch.json @@ -10,6 +10,20 @@ "program": "${workspaceRoot}/lib/main.dart", "type": "dart", "preLaunchTask": "build_flowy_sdk", + "env":{ + "RUST_LOG":"info", + }, + "cwd": "${workspaceRoot}" + }, + { + "name": "app_flowy(trace)", + "request": "launch", + "program": "${workspaceRoot}/lib/main.dart", + "type": "dart", + "preLaunchTask": "build_flowy_sdk", + "env":{ + "RUST_LOG":"trace", + }, "cwd": "${workspaceRoot}" }, { diff --git a/frontend/rust-lib/flowy-core/src/context.rs b/frontend/rust-lib/flowy-core/src/context.rs index bd009d1212..4df573515a 100644 --- a/frontend/rust-lib/flowy-core/src/context.rs +++ b/frontend/rust-lib/flowy-core/src/context.rs @@ -130,13 +130,11 @@ impl CoreContext { return Ok(()); } } - tracing::debug!("Start initializing flowy core"); INIT_WORKSPACE.write().insert(token.to_owned(), true); let _ = self.workspace_controller.init()?; let _ = self.app_controller.init()?; let _ = self.view_controller.init()?; let _ = self.trash_controller.init()?; - tracing::debug!("Finish initializing core"); Ok(()) } diff --git a/frontend/rust-lib/flowy-document/src/core/edit/editor.rs b/frontend/rust-lib/flowy-document/src/core/edit/editor.rs index 89672cfef6..aaa8f52d6a 100644 --- a/frontend/rust-lib/flowy-document/src/core/edit/editor.rs +++ b/frontend/rust-lib/flowy-document/src/core/edit/editor.rs @@ -18,6 +18,7 @@ use tokio::sync::{mpsc, mpsc::UnboundedSender, oneshot}; pub struct ClientDocumentEditor { pub doc_id: String, + #[allow(dead_code)] rev_manager: Arc, ws_manager: Arc, edit_queue: UnboundedSender, diff --git a/frontend/rust-lib/flowy-document/src/core/edit/queue.rs b/frontend/rust-lib/flowy-document/src/core/edit/queue.rs index 6df45450fb..6873ff0766 100644 --- a/frontend/rust-lib/flowy-document/src/core/edit/queue.rs +++ b/frontend/rust-lib/flowy-document/src/core/edit/queue.rs @@ -58,7 +58,7 @@ impl EditorCommandQueue { .await; } - #[tracing::instrument(level = "debug", skip(self), err)] + #[tracing::instrument(level = "trace", skip(self), err)] async fn handle_command(&self, command: EditorCommand) -> Result<(), FlowyError> { match command { EditorCommand::ComposeLocalDelta { delta, ret } => { @@ -289,6 +289,7 @@ pub(crate) enum EditorCommand { ReadDoc { ret: Ret, }, + #[allow(dead_code)] ReadDocDelta { ret: Ret, }, diff --git a/frontend/rust-lib/flowy-document/src/core/revision/cache.rs b/frontend/rust-lib/flowy-document/src/core/revision/cache.rs index eeecc039d6..db3647ee73 100644 --- a/frontend/rust-lib/flowy-document/src/core/revision/cache.rs +++ b/frontend/rust-lib/flowy-document/src/core/revision/cache.rs @@ -109,7 +109,7 @@ impl DocumentRevisionCache { } #[tracing::instrument(level = "debug", skip(self, doc_id, revisions))] - pub async fn reset_document(&self, doc_id: &str, revisions: Vec) -> FlowyResult<()> { + pub async fn reset_with_revisions(&self, doc_id: &str, revisions: Vec) -> FlowyResult<()> { let revision_records = revisions .to_vec() .into_iter() diff --git a/frontend/rust-lib/flowy-document/src/core/revision/disk/sql_impl.rs b/frontend/rust-lib/flowy-document/src/core/revision/disk/sql_impl.rs index 2976688419..189ec8ff2f 100644 --- a/frontend/rust-lib/flowy-document/src/core/revision/disk/sql_impl.rs +++ b/frontend/rust-lib/flowy-document/src/core/revision/disk/sql_impl.rs @@ -120,7 +120,11 @@ impl RevisionTableSql { .filter(dsl::rev_id.eq(changeset.rev_id.as_ref())) .filter(dsl::doc_id.eq(changeset.doc_id)); let _ = update(filter).set(dsl::state.eq(changeset.state)).execute(conn)?; - tracing::debug!("Save revision:{} state to {:?}", changeset.rev_id, changeset.state); + tracing::debug!( + "[[RevisionTable]] Save:{} state to {:?}", + changeset.rev_id, + changeset.state + ); Ok(()) } @@ -170,7 +174,7 @@ impl RevisionTableSql { } let affected_row = sql.execute(conn)?; - tracing::debug!("Delete {} revision rows", affected_row); + tracing::trace!("[RevisionTable] Delete {} rows", affected_row); Ok(()) } } diff --git a/frontend/rust-lib/flowy-document/src/core/revision/manager.rs b/frontend/rust-lib/flowy-document/src/core/revision/manager.rs index bab04cd81c..798f717bd8 100644 --- a/frontend/rust-lib/flowy-document/src/core/revision/manager.rs +++ b/frontend/rust-lib/flowy-document/src/core/revision/manager.rs @@ -60,7 +60,10 @@ impl DocumentRevisionManager { #[tracing::instrument(level = "debug", skip(self, revisions), err)] pub async fn reset_document(&self, revisions: RepeatedRevision) -> FlowyResult<()> { let rev_id = pair_rev_id_from_revisions(&revisions).1; - let _ = self.cache.reset_document(&self.doc_id, revisions.into_inner()).await?; + let _ = self + .cache + .reset_with_revisions(&self.doc_id, revisions.into_inner()) + .await?; self.rev_id_counter.set(rev_id); Ok(()) } diff --git a/frontend/rust-lib/flowy-document/src/core/web_socket/http_ws_impl.rs b/frontend/rust-lib/flowy-document/src/core/web_socket/http_ws_impl.rs index ea4433c73a..f74015b509 100644 --- a/frontend/rust-lib/flowy-document/src/core/web_socket/http_ws_impl.rs +++ b/frontend/rust-lib/flowy-document/src/core/web_socket/http_ws_impl.rs @@ -181,7 +181,7 @@ impl DocumentWSStream { .await .map_err(internal_error)?; - tracing::debug!("[DocumentStream]: new message: {:?}", ty); + tracing::trace!("[DocumentStream]: new message: {:?}", ty); match ty { DocumentServerWSDataType::ServerPushRev => { let _ = self.consumer.receive_push_revision(bytes).await?; @@ -272,7 +272,7 @@ impl DocumentWSSink { Ok(()) }, Some(data) => { - tracing::debug!("[DocumentSink]: send: {}:{}-{:?}", data.doc_id, data.id(), data.ty); + tracing::trace!("[DocumentSink]: send: {}:{}-{:?}", data.doc_id, data.id(), data.ty); self.ws_sender.send(data) // let _ = tokio::time::timeout(Duration::from_millis(2000), }, diff --git a/frontend/rust-lib/flowy-document/tests/document/document_test.rs b/frontend/rust-lib/flowy-document/tests/document/document_test.rs index 31ec87af6d..8c8e17aff1 100644 --- a/frontend/rust-lib/flowy-document/tests/document/document_test.rs +++ b/frontend/rust-lib/flowy-document/tests/document/document_test.rs @@ -55,6 +55,18 @@ async fn document_sync_insert_in_chinese() { EditorTest::new().await.run_scripts(scripts).await; } +#[tokio::test] +async fn document_sync_insert_with_emoji() { + let s = "๐Ÿ˜".to_owned(); + let offset = count_utf16_code_units(&s); + let scripts = vec![ + InsertText("๐Ÿ˜", 0), + InsertText("โ˜บ๏ธ", offset), + AssertJson(r#"[{"insert":"๐Ÿ˜โ˜บ๏ธ\n"}]"#), + ]; + EditorTest::new().await.run_scripts(scripts).await; +} + #[tokio::test] async fn document_sync_delete_in_english() { let scripts = vec![ diff --git a/frontend/rust-lib/flowy-net/src/services/local_ws/local_server.rs b/frontend/rust-lib/flowy-net/src/services/local_ws/local_server.rs index a5c8fdfcb8..8fb58f6630 100644 --- a/frontend/rust-lib/flowy-net/src/services/local_ws/local_server.rs +++ b/frontend/rust-lib/flowy-net/src/services/local_ws/local_server.rs @@ -40,7 +40,7 @@ impl LocalDocumentServer { client_data: DocumentClientWSData, user_id: String, ) -> Result<(), CollaborateError> { - tracing::debug!( + tracing::trace!( "[LocalDocumentServer] receive: {}:{}-{:?} ", client_data.doc_id, client_data.id(), @@ -72,7 +72,7 @@ struct LocalDocServerPersistence { } impl Debug for LocalDocServerPersistence { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.write_str("MockDocServerPersistence") } + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.write_str("LocalDocServerPersistence") } } impl std::default::Default for LocalDocServerPersistence { @@ -89,10 +89,7 @@ impl DocumentPersistence for LocalDocServerPersistence { let doc_id = doc_id.to_owned(); Box::pin(async move { match inner.get(&doc_id) { - None => { - // - Err(CollaborateError::record_not_found()) - }, + None => Err(CollaborateError::record_not_found()), Some(val) => { // Ok(val.value().clone()) diff --git a/frontend/rust-lib/flowy-sdk/src/lib.rs b/frontend/rust-lib/flowy-sdk/src/lib.rs index 57efe1ec24..4bae25397f 100644 --- a/frontend/rust-lib/flowy-sdk/src/lib.rs +++ b/frontend/rust-lib/flowy-sdk/src/lib.rs @@ -53,19 +53,19 @@ impl FlowySDKConfig { FlowySDKConfig { name: name.to_owned(), root: root.to_owned(), - log_filter: crate_log_filter(None), + log_filter: crate_log_filter("info".to_owned()), server_config, } } pub fn log_filter(mut self, filter: &str) -> Self { - self.log_filter = crate_log_filter(Some(filter.to_owned())); + self.log_filter = crate_log_filter(filter.to_owned()); self } } -fn crate_log_filter(level: Option) -> String { - let level = level.unwrap_or_else(|| std::env::var("RUST_LOG").unwrap_or_else(|_| "info".to_owned())); +fn crate_log_filter(level: String) -> String { + let level = std::env::var("RUST_LOG").unwrap_or(level); let mut filters = vec![]; filters.push(format!("flowy_sdk={}", level)); filters.push(format!("flowy_core={}", level)); @@ -73,6 +73,8 @@ fn crate_log_filter(level: Option) -> String { filters.push(format!("flowy_document={}", level)); filters.push(format!("flowy_collaboration={}", level)); filters.push(format!("flowy_net={}", level)); + filters.push(format!("dart_ffi={}", "info")); + filters.push(format!("dart_database={}", "info")); filters.push(format!("dart_notify={}", level)); filters.push(format!("lib_ot={}", level)); filters.push(format!("lib_ws={}", level)); diff --git a/frontend/rust-lib/flowy-test/src/lib.rs b/frontend/rust-lib/flowy-test/src/lib.rs index 844457fe9f..2ba8a20828 100644 --- a/frontend/rust-lib/flowy-test/src/lib.rs +++ b/frontend/rust-lib/flowy-test/src/lib.rs @@ -34,7 +34,7 @@ impl std::default::Default for FlowySDKTest { impl FlowySDKTest { pub fn new(server_config: ClientServerConfiguration) -> Self { - let config = FlowySDKConfig::new(&root_dir(), server_config, &uuid_string()).log_filter("debug"); + let config = FlowySDKConfig::new(&root_dir(), server_config, &uuid_string()).log_filter("trace"); let sdk = FlowySDK::new(config); std::mem::forget(sdk.dispatcher()); Self { inner: sdk } diff --git a/shared-lib/flowy-collaboration/src/document/document.rs b/shared-lib/flowy-collaboration/src/document/document.rs index ae4edbaf86..2cb5c196fb 100644 --- a/shared-lib/flowy-collaboration/src/document/document.rs +++ b/shared-lib/flowy-collaboration/src/document/document.rs @@ -69,6 +69,7 @@ impl Document { pub fn set_notify(&mut self, notify: mpsc::UnboundedSender<()>) { self.notify = Some(notify); } pub fn set_delta(&mut self, data: RichTextDelta) { + tracing::trace!("document: {}", data.to_json()); self.delta = data; match &self.notify { @@ -80,7 +81,6 @@ impl Document { } pub fn compose_delta(&mut self, delta: RichTextDelta) -> Result<(), CollaborateError> { - tracing::trace!("๐Ÿ‘‰ receive change: {}", delta); tracing::trace!("{} compose {}", &self.delta.to_json(), delta.to_json()); let composed_delta = self.delta.compose(&delta)?; let mut undo_delta = delta.invert(&self.delta); @@ -97,13 +97,11 @@ impl Document { self.last_edit_time = now; } - tracing::trace!("๐Ÿ‘‰ receive change undo: {}", undo_delta); if !undo_delta.is_empty() { + tracing::trace!("add history delta: {}", undo_delta); self.history.record(undo_delta); } - tracing::trace!("compose result: {}", composed_delta.to_json()); - self.set_delta(composed_delta); Ok(()) } @@ -133,7 +131,7 @@ impl Document { attribute: RichTextAttribute, ) -> Result { let _ = validate_interval(&self.delta, &interval)?; - tracing::trace!("format with {} at {}", attribute, interval); + tracing::trace!("format {} with {}", interval, attribute); let format_delta = self.view.format(&self.delta, attribute, interval).unwrap(); self.compose_delta(format_delta.clone())?; Ok(format_delta) @@ -192,7 +190,6 @@ impl Document { // c = a.compose(b) // d = b.invert(a) // a = c.compose(d) - tracing::trace!("Invert {}", delta); let new_delta = self.delta.compose(delta)?; let inverted_delta = delta.invert(&self.delta); Ok((new_delta, inverted_delta)) diff --git a/shared-lib/flowy-collaboration/src/document/extensions/format/resolve_block_format.rs b/shared-lib/flowy-collaboration/src/document/extensions/format/resolve_block_format.rs index ab78f46161..42f64c1b8a 100644 --- a/shared-lib/flowy-collaboration/src/document/extensions/format/resolve_block_format.rs +++ b/shared-lib/flowy-collaboration/src/document/extensions/format/resolve_block_format.rs @@ -10,7 +10,7 @@ use crate::{ pub struct ResolveBlockFormat {} impl FormatExt for ResolveBlockFormat { - fn ext_name(&self) -> &str { std::any::type_name::() } + fn ext_name(&self) -> &str { "ResolveBlockFormat" } fn apply(&self, delta: &RichTextDelta, interval: Interval, attribute: &RichTextAttribute) -> Option { if attribute.scope != AttributeScope::Block { diff --git a/shared-lib/flowy-collaboration/src/document/extensions/format/resolve_inline_format.rs b/shared-lib/flowy-collaboration/src/document/extensions/format/resolve_inline_format.rs index f82971f44d..036617ff85 100644 --- a/shared-lib/flowy-collaboration/src/document/extensions/format/resolve_inline_format.rs +++ b/shared-lib/flowy-collaboration/src/document/extensions/format/resolve_inline_format.rs @@ -10,7 +10,7 @@ use crate::{ pub struct ResolveInlineFormat {} impl FormatExt for ResolveInlineFormat { - fn ext_name(&self) -> &str { std::any::type_name::() } + fn ext_name(&self) -> &str { "ResolveInlineFormat" } fn apply(&self, delta: &RichTextDelta, interval: Interval, attribute: &RichTextAttribute) -> Option { if attribute.scope != AttributeScope::Inline { diff --git a/shared-lib/flowy-collaboration/src/document/extensions/insert/auto_exit_block.rs b/shared-lib/flowy-collaboration/src/document/extensions/insert/auto_exit_block.rs index c8824cb846..6516203a9d 100644 --- a/shared-lib/flowy-collaboration/src/document/extensions/insert/auto_exit_block.rs +++ b/shared-lib/flowy-collaboration/src/document/extensions/insert/auto_exit_block.rs @@ -7,7 +7,7 @@ use lib_ot::{ pub struct AutoExitBlock {} impl InsertExt for AutoExitBlock { - fn ext_name(&self) -> &str { std::any::type_name::() } + fn ext_name(&self) -> &str { "AutoExitBlock" } fn apply(&self, delta: &RichTextDelta, replace_len: usize, text: &str, index: usize) -> Option { // Auto exit block will be triggered by enter two new lines diff --git a/shared-lib/flowy-collaboration/src/document/extensions/insert/auto_format.rs b/shared-lib/flowy-collaboration/src/document/extensions/insert/auto_format.rs index 7104c69c00..de58e6d5d7 100644 --- a/shared-lib/flowy-collaboration/src/document/extensions/insert/auto_format.rs +++ b/shared-lib/flowy-collaboration/src/document/extensions/insert/auto_format.rs @@ -8,7 +8,7 @@ use url::Url; pub struct AutoFormatExt {} impl InsertExt for AutoFormatExt { - fn ext_name(&self) -> &str { std::any::type_name::() } + fn ext_name(&self) -> &str { "AutoFormatExt" } fn apply(&self, delta: &RichTextDelta, replace_len: usize, text: &str, index: usize) -> Option { // enter whitespace to trigger auto format diff --git a/shared-lib/flowy-collaboration/src/document/extensions/insert/default_insert.rs b/shared-lib/flowy-collaboration/src/document/extensions/insert/default_insert.rs index 074f3fa63d..5dbeab66cf 100644 --- a/shared-lib/flowy-collaboration/src/document/extensions/insert/default_insert.rs +++ b/shared-lib/flowy-collaboration/src/document/extensions/insert/default_insert.rs @@ -6,7 +6,7 @@ use lib_ot::{ pub struct DefaultInsertAttribute {} impl InsertExt for DefaultInsertAttribute { - fn ext_name(&self) -> &str { std::any::type_name::() } + fn ext_name(&self) -> &str { "DefaultInsertAttribute" } fn apply(&self, delta: &RichTextDelta, replace_len: usize, text: &str, index: usize) -> Option { let iter = DeltaIter::new(delta); diff --git a/shared-lib/flowy-collaboration/src/document/extensions/insert/preserve_block_format.rs b/shared-lib/flowy-collaboration/src/document/extensions/insert/preserve_block_format.rs index 128223a558..5df18aef1f 100644 --- a/shared-lib/flowy-collaboration/src/document/extensions/insert/preserve_block_format.rs +++ b/shared-lib/flowy-collaboration/src/document/extensions/insert/preserve_block_format.rs @@ -13,7 +13,7 @@ use lib_ot::{ pub struct PreserveBlockFormatOnInsert {} impl InsertExt for PreserveBlockFormatOnInsert { - fn ext_name(&self) -> &str { std::any::type_name::() } + fn ext_name(&self) -> &str { "PreserveBlockFormatOnInsert" } fn apply(&self, delta: &RichTextDelta, replace_len: usize, text: &str, index: usize) -> Option { if !is_newline(text) { diff --git a/shared-lib/flowy-collaboration/src/document/extensions/insert/preserve_inline_format.rs b/shared-lib/flowy-collaboration/src/document/extensions/insert/preserve_inline_format.rs index a593ae1c6e..672ab6af2d 100644 --- a/shared-lib/flowy-collaboration/src/document/extensions/insert/preserve_inline_format.rs +++ b/shared-lib/flowy-collaboration/src/document/extensions/insert/preserve_inline_format.rs @@ -9,7 +9,7 @@ use lib_ot::{ pub struct PreserveInlineFormat {} impl InsertExt for PreserveInlineFormat { - fn ext_name(&self) -> &str { std::any::type_name::() } + fn ext_name(&self) -> &str { "PreserveInlineFormat" } fn apply(&self, delta: &RichTextDelta, replace_len: usize, text: &str, index: usize) -> Option { if contain_newline(text) { @@ -53,7 +53,7 @@ impl InsertExt for PreserveInlineFormat { pub struct PreserveLineFormatOnSplit {} impl InsertExt for PreserveLineFormatOnSplit { - fn ext_name(&self) -> &str { std::any::type_name::() } + fn ext_name(&self) -> &str { "PreserveLineFormatOnSplit" } fn apply(&self, delta: &RichTextDelta, replace_len: usize, text: &str, index: usize) -> Option { if !is_newline(text) { diff --git a/shared-lib/flowy-collaboration/src/document/extensions/insert/reset_format_on_new_line.rs b/shared-lib/flowy-collaboration/src/document/extensions/insert/reset_format_on_new_line.rs index 014d74ad81..c920d6f22b 100644 --- a/shared-lib/flowy-collaboration/src/document/extensions/insert/reset_format_on_new_line.rs +++ b/shared-lib/flowy-collaboration/src/document/extensions/insert/reset_format_on_new_line.rs @@ -6,7 +6,7 @@ use lib_ot::{ pub struct ResetLineFormatOnNewLine {} impl InsertExt for ResetLineFormatOnNewLine { - fn ext_name(&self) -> &str { std::any::type_name::() } + fn ext_name(&self) -> &str { "ResetLineFormatOnNewLine" } fn apply(&self, delta: &RichTextDelta, replace_len: usize, text: &str, index: usize) -> Option { if !is_newline(text) { diff --git a/shared-lib/flowy-collaboration/src/document/view.rs b/shared-lib/flowy-collaboration/src/document/view.rs index 4fb992cbcb..21978a84e2 100644 --- a/shared-lib/flowy-collaboration/src/document/view.rs +++ b/shared-lib/flowy-collaboration/src/document/view.rs @@ -32,7 +32,7 @@ impl View { for ext in &self.insert_exts { if let Some(mut delta) = ext.apply(delta, interval.size(), text, interval.start) { trim(&mut delta); - tracing::debug!("[{}]: process delta: {}", ext.ext_name(), delta); + tracing::debug!("[{} extension]: process: {}", ext.ext_name(), delta); new_delta = Some(delta); break; } diff --git a/shared-lib/flowy-collaboration/src/sync/server.rs b/shared-lib/flowy-collaboration/src/sync/server.rs index bcd6caa3ea..ad30b51070 100644 --- a/shared-lib/flowy-collaboration/src/sync/server.rs +++ b/shared-lib/flowy-collaboration/src/sync/server.rs @@ -89,7 +89,7 @@ impl ServerDocumentManager { let doc_id = client_data.doc_id.clone(); match self.get_document_handler(&doc_id).await { None => { - tracing::warn!("Document:{} doesn't exist, ignore pinging", doc_id); + tracing::trace!("Document:{} doesn't exist, ignore pinging", doc_id); Ok(()) }, Some(handler) => { diff --git a/shared-lib/flowy-collaboration/src/sync/synchronizer.rs b/shared-lib/flowy-collaboration/src/sync/synchronizer.rs index 48f7e8fb63..ff3c884f4b 100644 --- a/shared-lib/flowy-collaboration/src/sync/synchronizer.rs +++ b/shared-lib/flowy-collaboration/src/sync/synchronizer.rs @@ -111,7 +111,7 @@ impl RevisionSynchronizer { Ok(()) } - #[tracing::instrument(level = "debug", skip(self, user, persistence), fields(server_rev_id), err)] + #[tracing::instrument(level = "trace", skip(self, user, persistence), fields(server_rev_id), err)] pub async fn pong( &self, user: Arc, @@ -125,7 +125,7 @@ impl RevisionSynchronizer { Ordering::Less => { tracing::error!("Client should not send ping and the server should pull the revisions from the client") }, - Ordering::Equal => tracing::debug!("{} is up to date.", doc_id), + Ordering::Equal => tracing::trace!("{} is up to date.", doc_id), Ordering::Greater => { // The client document is outdated. Transform the client revision delta and then // send the prime delta to the client. Client should compose the this prime diff --git a/shared-lib/lib-ot/src/core/delta/delta.rs b/shared-lib/lib-ot/src/core/delta/delta.rs index 45f700afd6..526b3f5c9d 100644 --- a/shared-lib/lib-ot/src/core/delta/delta.rs +++ b/shared-lib/lib-ot/src/core/delta/delta.rs @@ -394,9 +394,7 @@ where if other.is_empty() { return inverted; } - tracing::trace!("๐ŸŒœCalculate invert delta"); - tracing::trace!("current: {}", self); - tracing::trace!("other: {}", other); + let mut index = 0; for op in &self.ops { let len: usize = op.len() as usize; @@ -409,20 +407,19 @@ where match op.has_attribute() { true => invert_from_other(&mut inverted, other, op, index, index + len), false => { - tracing::trace!("invert retain: {} by retain {} {}", op, len, op.get_attributes()); + // tracing::trace!("invert retain: {} by retain {} {}", op, len, + // op.get_attributes()); inverted.retain(len as usize, op.get_attributes()) }, } index += len; }, Operation::Insert(_) => { - tracing::trace!("invert insert: {} by delete {}", op, len); + // tracing::trace!("invert insert: {} by delete {}", op, len); inverted.delete(len as usize); }, } } - - tracing::trace!("๐ŸŒ›invert result: {}", inverted); inverted } }