Specify different message formatting for `uvm_info, `uvm_warning, etc messages displayed on stdout and for those printed in log

In reply to kaushalmodi:

Hi,
I am creating a custom_report_server class by extending the uvm_report_server class.
I’d like to highlight the message tags based on their severity. For example, in the below code snippet from my custom “compose_message” function, I am highlighting the “UVM_ERROR” tag in Red.


// more code
end else if (severity_type.name()=="UVM_ERROR") begin
severity_str  = $sformatf("  \033[0;37;41m%s\033[0m", "UVM_ERROR");
end
// more code

This works and looks great when reviewing the printed messages live in terminal/stdout.
But the problem is that the ANSI color codes get printed in the simulation log file too and so the log looks very cluttered with the “\033[0;37;41mUVM_ERROR\033[0m” strings.
Is there a way to specify ANSI color coded formatting only for the stdout messages and non-color-coded messages for the stream that is logged to files?
Thanks!
Kaushal Modi

hello sir

please you can give more detail on this …

thanks & regards
Ashish Saroj