From 9155671d7920ec24280e20d2f8e41755569b43b4 Mon Sep 17 00:00:00 2001 From: pvshvp-oss Date: Sat, 11 May 2024 23:41:25 -0500 Subject: [PATCH] Change how output is displayed --- paxy/src/app/logging.rs | 11 +++----- paxy/src/app/ui.rs | 57 ++++++++++++++++++++++++++++++++--------- 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/paxy/src/app/logging.rs b/paxy/src/app/logging.rs index 6dd81bf..62229ec 100644 --- a/paxy/src/app/logging.rs +++ b/paxy/src/app/logging.rs @@ -161,12 +161,9 @@ pub fn init_log(config: &config::ConfigTemplate) -> Result { .console_output_format .mode { - ui::ConsoleOutputMode::Plain => logging_handle - .switch_to_plain()?, - ui::ConsoleOutputMode::Json => logging_handle - .switch_to_json()?, - ui::ConsoleOutputMode::Test => logging_handle - .switch_to_test()?, + ui::ConsoleOutputMode::Plain => logging_handle.switch_to_plain()?, + ui::ConsoleOutputMode::Json => logging_handle.switch_to_json()?, + ui::ConsoleOutputMode::Test => logging_handle.switch_to_test()?, _ => {} }; @@ -291,6 +288,6 @@ use tracing_subscriber::{ Layer, }; -use crate::app::{self, ui, config}; +use crate::app::{self, config, ui}; // endregion: IMPORTS diff --git a/paxy/src/app/ui.rs b/paxy/src/app/ui.rs index 6c43fe7..6a6cc11 100644 --- a/paxy/src/app/ui.rs +++ b/paxy/src/app/ui.rs @@ -18,9 +18,9 @@ where emit_welcome_messages(); - emit_diagnostic_messages(&config, &console_input); + emit_diagnostic_messages(&config); - emit_test_messages(); + emit_test_messages(&config, &console_input); Ok((console_input, logging_handle.worker_guards)) } @@ -40,10 +40,18 @@ fn emit_welcome_messages() { ); } -fn emit_diagnostic_messages(config: &ConfigTemplate, console_input: &C) -where - C: clap::Parser + fmt::Debug, -{ +fn emit_diagnostic_messages(config: &ConfigTemplate) { + tracing::trace!( + "{} {} messages {}...", + console::Emoji("๐Ÿ”", ""), + "Diagnostic" + .cyan() + .dimmed(), + "begin" + .green() + .dimmed(), + ); + tracing::debug!( "{} The {} is {}... {}", console::Emoji("โš™๏ธ", ""), @@ -74,16 +82,21 @@ where ); tracing::trace!( - "{} {} {:#?}", - console::Emoji("โŒจ๏ธ", ""), - "CLI input arguments:" - .magenta() + "{} {} messages {}...", + console::Emoji("๐Ÿ”", ""), + "Diagnostic" + .cyan() + .dimmed(), + "end" + .green() .dimmed(), - console_input.dimmed() ); } -fn emit_test_messages() { +fn emit_test_messages(config: &ConfigTemplate, console_input: &C) +where + C: clap::Parser + fmt::Debug, +{ tracing::debug!( target:"TEST", "{}{}{}{}{}{}{}{}", "โ–ˆโ–ˆโ–ˆ".black(), @@ -115,6 +128,26 @@ fn emit_test_messages() { tracing::info!(target:"JSON", "{} Testing: {}", console::Emoji("๐Ÿงช", ""), "{\"JSON\": \"Target\"}"); tracing::info!(target:"PLAIN", "{} Testing: Plain Target", console::Emoji("๐Ÿงช", "")); + + tracing::info!( + target:"TEST", + "{} {} {:#?}", + console::Emoji("โŒจ๏ธ", ""), + "CLI input arguments:" + .magenta() + .dimmed(), + console_input.dimmed() + ); + + tracing::info!( + target:"TEST", + "{} {} {:#?}", + console::Emoji("โŒจ๏ธ", ""), + "Config dump:" + .magenta() + .dimmed(), + config.dimmed() + ); } #[derive(Debug, Clone, Serialize, Deserialize)]