When I run a node template with cargo run -r -- --dev I get a whole bunch of debug info in the terminal.
Is it possible to change colors of some words (phrases) in the terminal output? For example: color of best and finalized blocks.

1 Answer 1


TL;DR: see https://stackoverflow.com/questions/4267400/colour-highlighting-output-based-on-regex-in-shell It is quite likely you just want to highlight within the terminal when operating.

I you want to build this into your node's logic, read on.

To start, the log crate is used in AFAIK all places stdout/stderr logging is enabled in Substrate. Substrate provides a minimal Wasm ready logger implementation: runtime_logger that is used in the runtime API described here.

But the meat of your question relates to the logging crates, specifically EventFormat.enable_color and the associated logic that stems from it. See the /client/tracing/src/logging/* implementation in Substrate for trace-level logging color schmeme.

For a custom logger that had such nuanced coloring built in, IIUC you would need to implement this are replace the present logic. Perhaps as stated to start, you simply want to highlight keywords rather than chage logic o the node.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.