radixdlt-scrypto icon indicating copy to clipboard operation
radixdlt-scrypto copied to clipboard

Add colored output to the following macros `info!()` , `warn!()` and `error!()`

Open plymth opened this issue 1 year ago • 2 comments

When running scrypto tests with scrypto test -- --nocapture due to the amount of output displayed it can be hard to track some of the info messages you have logged. Could we leverage the colored crate to add colored output to the following macros:

info!() -> blue warn!() -> yellow error!() -> red

I think it might be possible to do something like this:

use colored::Colorize;
...
macro_rules! info {
    ($($args: expr),+) => {{
        ::scrypto::core::Logger::log(scrypto::core::Level::Info.blue(), ::sbor::rust::format!($($args),+).blue());
    }};
}

plymth avatar Oct 03 '22 11:10 plymth

By convention, info usually either green or default terminal colour

beemdvp avatar Oct 03 '22 15:10 beemdvp

By convention, info usually either green or default terminal colour

It was the default white color that was causing the readability issues, but sure green or blue is fine with me 😁 .

plymth avatar Oct 03 '22 16:10 plymth

Will add it internal tracking of desired resim features.

russellharvey avatar Jul 07 '23 15:07 russellharvey