Skip to content

Commit

Permalink
[all] Remove needless functions from logging_api.rs - log_debug()
Browse files Browse the repository at this point in the history
  • Loading branch information
nazmulidris committed Sep 28, 2024
1 parent acc8585 commit f1cef55
Show file tree
Hide file tree
Showing 16 changed files with 141 additions and 226 deletions.
6 changes: 2 additions & 4 deletions cmdr/src/bin/edi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use clap::Parser;
use r3bl_ansi_color::{AnsiStyledText, Style};
use r3bl_cmdr::{edi::launcher, report_analytics, upgrade_check, AnalyticsAction};
use r3bl_rs_utils_core::{call_if_true,
log_debug,
throws,
try_initialize_global_logging,
ColorWheel,
Expand All @@ -44,8 +43,7 @@ async fn main() -> CommonResult<()> {
let enable_logging = cli_arg.global_options.enable_logging;
call_if_true!(enable_logging, {
try_initialize_global_logging(tracing_core::LevelFilter::DEBUG).ok();
log_debug("Start logging...".to_string());
log_debug(format!("cli_args {:?}", cli_arg));
tracing::debug!("Start logging... cli_args {:?}", cli_arg);
});

// Check analytics reporting.
Expand Down Expand Up @@ -90,7 +88,7 @@ async fn main() -> CommonResult<()> {

// Stop logging.
call_if_true!(enable_logging, {
log_debug("Stop logging...".to_string());
tracing::debug!("Stop logging...");
});

// Exit message.
Expand Down
6 changes: 2 additions & 4 deletions cmdr/src/bin/giti.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ use r3bl_cmdr::{color_constants::DefaultColors::{FrozenBlue, GuardsRed, Moonligh
upgrade_check,
AnalyticsAction};
use r3bl_rs_utils_core::{call_if_true,
log_debug,
throws,
try_initialize_global_logging,
CommonResult};
Expand All @@ -52,8 +51,7 @@ async fn main() -> CommonResult<()> {
let enable_logging = cli_arg.global_options.enable_logging;
call_if_true!(enable_logging, {
try_initialize_global_logging(tracing_core::LevelFilter::DEBUG).ok();
log_debug("Start logging...".to_string());
log_debug(format!("cli_args {:?}", cli_arg));
tracing::debug!("Start logging... cli_args {:?}", cli_arg);
});

// Check analytics reporting.
Expand All @@ -70,7 +68,7 @@ async fn main() -> CommonResult<()> {
launch_giti(cli_arg);

call_if_true!(enable_logging, {
log_debug("Stop logging...".to_string());
tracing::debug!("Stop logging...");
});
})
}
Expand Down
34 changes: 10 additions & 24 deletions cmdr/src/edi/app_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use r3bl_rs_utils_core::{call_if_true,
ch,
get_tui_style,
get_tui_styles,
log_debug,
position,
requested_size_percent,
send_signal,
Expand Down Expand Up @@ -151,8 +150,7 @@ mod app_main_constructor {
impl Default for AppMain {
fn default() -> Self {
call_if_true!(DEBUG_TUI_MOD, {
let msg = format!("🪙 {}", "construct edi::AppMain");
log_debug(msg);
tracing::debug!("🪙 construct edi::AppMain");
});
Self
}
Expand Down Expand Up @@ -216,10 +214,9 @@ mod app_main_impl_app_trait {
match result_open {
Ok(_) => {
call_if_true!(DEBUG_TUI_MOD, {
log_debug(
format!("\n📣 Opened feedback link: {link_url:?}")
.green()
.to_string(),
tracing::debug!(
"\n📣 Opened feedback link: {}",
format!("{link_url:?}").green()
);
});
}
Expand Down Expand Up @@ -407,8 +404,7 @@ mod modal_dialog_ask_for_filename_to_save_file {
);

call_if_true!(DEBUG_TUI_MOD, {
let msg = format!("📣 activate modal simple: {:?}", has_focus);
log_debug(msg);
tracing::debug!("📣 activate modal simple: {:?}", has_focus);
});
});
}
Expand Down Expand Up @@ -464,10 +460,8 @@ mod modal_dialog_ask_for_filename_to_save_file {
let user_input_file_path = text.trim().to_string();
if !user_input_file_path.is_empty() {
call_if_true!(DEBUG_TUI_MOD, {
let msg = format!("\n💾💾💾 About to save the new buffer with given filename: {user_input_file_path:?}")
.magenta()
.to_string();
log_debug(msg);
tracing::debug!("\n💾💾💾 About to save the new buffer with given filename: {}",
format!("{user_input_file_path:?}").magenta());
});

let maybe_editor_buffer = state.get_mut_editor_buffer(
Expand Down Expand Up @@ -526,11 +520,7 @@ mod modal_dialog_ask_for_filename_to_save_file {
);

call_if_true!(DEBUG_TUI_MOD, {
let msg = format!(
"🪙 {}",
"construct DialogComponent (simple) { on_dialog_press }"
);
log_debug(msg);
tracing::debug!("🪙 construct DialogComponent (simple) [ on_dialog_press ]",);
});
}
}
Expand Down Expand Up @@ -606,10 +596,7 @@ mod populate_component_registry {
has_focus.set_id(id);

call_if_true!(DEBUG_TUI_MOD, {
{
let msg = format!("🪙 {} = {:?}", "init has_focus", has_focus.get_id());
log_debug(msg);
}
tracing::debug!("🪙 {} = {:?}", "init has_focus", has_focus.get_id());
});
}

Expand Down Expand Up @@ -638,8 +625,7 @@ mod populate_component_registry {
ComponentRegistry::put(component_registry_map, id, boxed_editor_component);

call_if_true!(DEBUG_TUI_MOD, {
let msg = format!("🪙 {}", "construct EditorComponent { on_buffer_change }");
log_debug(msg);
tracing::debug!("🪙 construct EditorComponent [ on_buffer_change ]");
});
}
}
Expand Down
30 changes: 8 additions & 22 deletions tui/examples/demo/ex_editor/app_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use r3bl_rs_utils_core::{call_if_true,
ch,
get_tui_style,
get_tui_styles,
log_debug,
position,
requested_size_percent,
send_signal,
Expand Down Expand Up @@ -121,8 +120,7 @@ mod constructor {
impl Default for AppMain {
fn default() -> Self {
call_if_true!(DEBUG_TUI_MOD, {
let msg = format!("🪙 {}", "construct ex_rc::AppMain");
log_debug(msg);
tracing::debug!("🪙 construct ex_rc::AppMain");
});
Self
}
Expand Down Expand Up @@ -441,8 +439,7 @@ mod modal_dialogs {
);

call_if_true!(DEBUG_TUI_MOD, {
let msg = format!("📣 activate modal simple: {:?}", has_focus);
log_debug(msg);
tracing::debug!("📣 activate modal simple: {:?}", has_focus);
});
});
}
Expand Down Expand Up @@ -478,8 +475,7 @@ mod modal_dialogs {
);

call_if_true!(DEBUG_TUI_MOD, {
let msg = format!("📣 activate modal autocomplete: {:?}", has_focus);
log_debug(msg);
tracing::debug!("📣 activate modal autocomplete: {:?}", has_focus);
});

Ok(())
Expand Down Expand Up @@ -567,10 +563,7 @@ mod populate_component_registry {
has_focus.set_id(id);

call_if_true!(DEBUG_TUI_MOD, {
{
let msg = format!("🪙 {} = {:?}", "init has_focus", has_focus.get_id());
log_debug(msg);
}
tracing::debug!("🪙 init has_focus = {:?}", has_focus.get_id());
});
}

Expand Down Expand Up @@ -599,8 +592,7 @@ mod populate_component_registry {
ComponentRegistry::put(component_registry_map, id, boxed_editor_component);

call_if_true!(DEBUG_TUI_MOD, {
let msg = format!("🪙 {}", "construct EditorComponent { on_buffer_change }");
log_debug(msg);
tracing::debug!("🪙 construct EditorComponent [ on_buffer_change ]");
});
}

Expand Down Expand Up @@ -683,11 +675,7 @@ mod populate_component_registry {
);

call_if_true!(DEBUG_TUI_MOD, {
let msg = format!(
"🪙 {}",
"construct DialogComponent (simple) { on_dialog_press }"
);
log_debug(msg);
tracing::debug!("🪙 construct DialogComponent (simple) [ on_dialog_press ]");
});
}

Expand Down Expand Up @@ -770,11 +758,9 @@ mod populate_component_registry {
);

call_if_true!(DEBUG_TUI_MOD, {
let msg = format!(
"🪙 {}",
"construct DialogComponent (autocomplete) { on_dialog_press }"
tracing::debug!(
"🪙 construct DialogComponent (autocomplete) [ on_dialog_press ]"
);
log_debug(msg);
});
}
}
Expand Down
12 changes: 3 additions & 9 deletions tui/examples/demo/ex_pitch/app_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use std::fmt::Debug;
use r3bl_rs_utils_core::{call_if_true,
ch,
get_tui_styles,
log_debug,
position,
requested_size_percent,
send_signal,
Expand Down Expand Up @@ -103,8 +102,7 @@ mod constructor {
impl Default for AppMain {
fn default() -> Self {
call_if_true!(DEBUG_TUI_MOD, {
let msg = format!("🪙 {}", "construct ex_pitch::AppWithLayout");
log_debug(msg);
tracing::debug!("🪙 construct ex_pitch::AppWithLayout");
});
Self
}
Expand Down Expand Up @@ -303,10 +301,7 @@ mod populate_component_registry {
// Switch focus to the editor component if focus is not set.
has_focus.set_id(id);
call_if_true!(DEBUG_TUI_MOD, {
{
let msg = format!("🪙 {} = {:?}", "init has_focus", has_focus.get_id());
log_debug(msg);
}
tracing::debug!("🪙 init has_focus = {:?}", has_focus.get_id());
});
}

Expand Down Expand Up @@ -339,8 +334,7 @@ mod populate_component_registry {
ComponentRegistry::put(component_registry_map, id, boxed_editor_component);

call_if_true!(DEBUG_TUI_MOD, {
let msg = format!("🪙 {}", "construct EditorComponent { on_buffer_change }");
log_debug(msg);
tracing::debug!("🪙 construct EditorComponent [ on_buffer_change ]");
});
}
}
Expand Down
10 changes: 3 additions & 7 deletions tui/examples/demo/ex_rc/app_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use chrono::{DateTime, Local};
use r3bl_rs_utils_core::{call_if_true,
ch,
get_tui_styles,
log_debug,
position,
requested_size_percent,
send_signal,
Expand Down Expand Up @@ -189,8 +188,7 @@ mod constructor {
impl Default for AppMain {
fn default() -> Self {
call_if_true!(DEBUG_TUI_MOD, {
let msg = format!("🪙 {}", "construct ex_rc::AppWithLayout");
log_debug(msg);
tracing::debug!("🪙 construct ex_rc::AppWithLayout");
});
Self {
data: AppData {
Expand Down Expand Up @@ -431,8 +429,7 @@ mod populate_component_registry {
has_focus.set_id(id);
call_if_true!(DEBUG_TUI_MOD, {
{
let msg = format!("🪙 {} = {:?}", "init has_focus", has_focus.get_id());
log_debug(msg);
tracing::debug!("🪙 init has_focus = {:?}", has_focus.get_id());
}
});
}
Expand Down Expand Up @@ -466,8 +463,7 @@ mod populate_component_registry {
ComponentRegistry::put(component_registry_map, id, boxed_editor_component);

call_if_true!(DEBUG_TUI_MOD, {
let msg = format!("🪙 {}", "construct EditorComponent { on_buffer_change }");
log_debug(msg);
tracing::debug!("🪙 construct EditorComponent [ on_buffer_change ]");
});
}
}
Expand Down
10 changes: 5 additions & 5 deletions tui/src/tui/dialog/dialog_component/dialog_component_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
use std::fmt::Debug;

use r3bl_rs_utils_core::{call_if_true,
common::{CommonError, CommonErrorType, CommonResult},
log_debug};
common::{CommonError, CommonErrorType, CommonResult}};

use crate::{Component,
DialogEngine,
Expand Down Expand Up @@ -173,9 +172,10 @@ where
has_focus.reset_modal_id();

call_if_true!(DEBUG_TUI_MOD, {
let msg =
format!("🐝 restore focus to non modal: {:?}", has_focus);
log_debug(msg);
tracing::debug!(
"🐝 restore focus to non modal: {:?}",
has_focus
);
});

// Run the handler (if any) w/ `dialog_choice`.
Expand Down
Loading

0 comments on commit f1cef55

Please sign in to comment.