Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix flutter log #5038

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class SidebarWorkspace extends StatelessWidget {
}

if (message != null) {
Log.info('[Workspace] $message');
showSnackBarMessage(context, message);
}
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/rust-lib/collab-integrate/src/collab_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions frontend/rust-lib/dart-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
9 changes: 5 additions & 4 deletions frontend/rust-lib/dart-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ mod env_serde;
mod model;
mod notification;
mod protobuf;
mod util;

lazy_static! {
static ref APPFLOWY_CORE: MutexAppFlowyCore = MutexAppFlowyCore::new();
Expand Down Expand Up @@ -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.
Expand All @@ -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,
Expand All @@ -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))
},
Expand All @@ -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() {
Expand Down Expand Up @@ -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) => {
Expand Down
1 change: 0 additions & 1 deletion frontend/rust-lib/dart-ffi/src/util.rs

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/rust-lib/flowy-core/src/integrate/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ pub(crate) fn create_log_filter(level: String, with_crates: Vec<String>) -> 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));
}

Expand Down
Loading