Skip to main content

msg_print

Macro msg_print 

Source
macro_rules! msg_print {
    ($msg:expr) => { ... };
    ($msg:expr, true) => { ... };
}
Expand description

Prints a general message with automatic debug mode routing.

This macro provides the basic message display functionality with automatic detection of debug mode to route output appropriately. It supports both simple single-line messages and formatted messages with optional line breaks.

§Output Routing

  • Debug Mode: Uses tracing::info! for structured logging
  • Normal Mode: Uses println! for simple console output

§Usage Patterns

§Simple Message

use kasl::msg_print;
use kasl::libs::messages::types::Message;

msg_print!(Message::ConfigSaved);
// Output: "Configuration saved successfully"

§Message with Line Breaks

use kasl::msg_print;
use kasl::libs::messages::types::Message;

msg_print!(Message::ReportHeader("2025-01-15".to_string()), true);
// Output: "\n📊 Daily Work Report\n"

§Performance Notes

  • Debug mode detection is cached for efficiency
  • Tracing integration provides structured logging in debug mode
  • Simple println! provides fast output in production mode