diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_workspace.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_workspace.dart index 8161b2ed7a..08c4d1e270 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_workspace.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_workspace.dart @@ -118,6 +118,7 @@ class SidebarWorkspace extends StatelessWidget { } if (message != null) { + Log.info('[Workspace] $message'); showSnackBarMessage(context, message); } } diff --git a/frontend/rust-lib/collab-integrate/src/collab_builder.rs b/frontend/rust-lib/collab-integrate/src/collab_builder.rs index d29ba8452e..71ed7a68a1 100644 --- a/frontend/rust-lib/collab-integrate/src/collab_builder.rs +++ b/frontend/rust-lib/collab-integrate/src/collab_builder.rs @@ -21,7 +21,7 @@ use collab_plugins::local_storage::CollabPersistenceConfig; use lib_infra::{if_native, if_wasm}; use parking_lot::{Mutex, RwLock}; -use tracing::{error, trace}; +use tracing::trace; #[derive(Clone, Debug)] pub enum CollabPluginProviderType { diff --git a/frontend/rust-lib/dart-ffi/Cargo.toml b/frontend/rust-lib/dart-ffi/Cargo.toml index 97e7034a6d..f1dedab5b4 100644 --- a/frontend/rust-lib/dart-ffi/Cargo.toml +++ b/frontend/rust-lib/dart-ffi/Cargo.toml @@ -51,6 +51,7 @@ dart = ["flowy-core/dart"] rev-sqlite = ["flowy-core/rev-sqlite"] http_sync = ["flowy-core/http_sync", "flowy-core/use_bunyan"] openssl_vendored = ["flowy-core/openssl_vendored"] +verbose_log = [] [build-dependencies] flowy-codegen = { workspace = true, features = ["dart"] } diff --git a/frontend/rust-lib/dart-ffi/src/lib.rs b/frontend/rust-lib/dart-ffi/src/lib.rs index 0ae56ce015..0c52c8ecab 100644 --- a/frontend/rust-lib/dart-ffi/src/lib.rs +++ b/frontend/rust-lib/dart-ffi/src/lib.rs @@ -29,7 +29,6 @@ mod env_serde; mod model; mod notification; mod protobuf; -mod util; lazy_static! { static ref APPFLOWY_CORE: MutexAppFlowyCore = MutexAppFlowyCore::new(); @@ -65,15 +64,13 @@ pub extern "C" fn init_sdk(_port: i64, data: *mut c_char) -> i64 { let _ = save_appflowy_cloud_config(&configuration.root, &configuration.appflowy_cloud_config); } - let log_crates = vec!["flowy-ffi".to_string()]; let config = AppFlowyCoreConfig::new( configuration.app_version, configuration.custom_app_path, configuration.origin_app_path, configuration.device_id, DEFAULT_NAME.to_string(), - ) - .log_filter("info", log_crates); + ); // Ensure that the database is closed before initialization. Also, verify that the init_sdk function can be called // multiple times (is reentrant). Currently, only the database resource is exclusive. @@ -95,6 +92,7 @@ pub extern "C" fn init_sdk(_port: i64, data: *mut c_char) -> i64 { #[allow(clippy::let_underscore_future)] pub extern "C" fn async_event(port: i64, input: *const u8, len: usize) { let request: AFPluginRequest = FFIRequest::from_u8_pointer(input, len).into(); + #[cfg(feature = "sync_verbose_log")] trace!( "[FFI]: {} Async Event: {:?} with {} port", &request.id, @@ -113,6 +111,7 @@ pub extern "C" fn async_event(port: i64, input: *const u8, len: usize) { dispatcher.as_ref(), request, move |resp: AFPluginEventResponse| { + #[cfg(feature = "sync_verbose_log")] trace!("[FFI]: Post data to dart through {} port", port); Box::pin(post_to_flutter(resp, port)) }, @@ -122,6 +121,7 @@ pub extern "C" fn async_event(port: i64, input: *const u8, len: usize) { #[no_mangle] pub extern "C" fn sync_event(input: *const u8, len: usize) -> *const u8 { let request: AFPluginRequest = FFIRequest::from_u8_pointer(input, len).into(); + #[cfg(feature = "sync_verbose_log")] trace!("[FFI]: {} Sync Event: {:?}", &request.id, &request.event,); let dispatcher = match APPFLOWY_CORE.dispatcher() { @@ -162,6 +162,7 @@ async fn post_to_flutter(response: AFPluginEventResponse, port: i64) { .await { Ok(_success) => { + #[cfg(feature = "sync_verbose_log")] trace!("[FFI]: Post data to dart success"); }, Err(e) => { diff --git a/frontend/rust-lib/dart-ffi/src/util.rs b/frontend/rust-lib/dart-ffi/src/util.rs deleted file mode 100644 index 8b13789179..0000000000 --- a/frontend/rust-lib/dart-ffi/src/util.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/frontend/rust-lib/flowy-core/src/integrate/log.rs b/frontend/rust-lib/flowy-core/src/integrate/log.rs index 8ffaa5e329..44ea8da213 100644 --- a/frontend/rust-lib/flowy-core/src/integrate/log.rs +++ b/frontend/rust-lib/flowy-core/src/integrate/log.rs @@ -38,11 +38,11 @@ pub(crate) fn create_log_filter(level: String, with_crates: Vec) -> Stri filters.push(format!("flowy_server={}", level)); filters.push(format!("flowy_notification={}", "info")); filters.push(format!("lib_infra={}", level)); + filters.push(format!("dart_ffi={}", level)); // ⚠️Enable debug log for dart_ffi, flowy_sqlite and lib_dispatch as needed. Don't enable them by default. { // filters.push(format!("flowy_sqlite={}", "info")); - // filters.push(format!("dart_ffi={}", "info")); // filters.push(format!("lib_dispatch={}", level)); }