1 //! Convenient functions to print messages to console. 2 3 #[macro_export] 4 macro_rules! console_blue { 5 ( $text:expr ) => { 6 format!("\x1b[1;34m{}\x1b[0m", $text).as_str() 7 }; 8 } 9 10 #[macro_export] 11 macro_rules! console_yellow { 12 ( $text:expr ) => { 13 format!("\x1b[1;33m{}\x1b[0m", $text).as_str() 14 }; 15 } 16 17 #[macro_export] 18 macro_rules! console_red { 19 ( $text:expr ) => { 20 format!("\x1b[1;31m{}\x1b[0m", $text).as_str() 21 }; 22 } 23 24 #[macro_export] 25 macro_rules! print_info { 26 ( $($arg:tt)* ) => { 27 { 28 print!("{}: ", console_yellow!("btclient:info")); 29 println!($($arg)*); 30 } 31 }; 32 } 33 34 #[macro_export] 35 macro_rules! print_error { 36 ( $($arg:tt)* ) => { 37 { 38 print!("{}: ", console_red!("btclient:error")); 39 println!($($arg)*); 40 } 41 }; 42 } 43