How to override severity report from UVM_ERROR to UVM_WARNING of a module

In reply to Asraful_21:

The `uvm_info/warning/error/fatal macros call the functions uvm_report_info/warning/error/fatal. These functions are defined as methods in the uvm_report_object and uvm_sequence_item classes as well as globally defined in the uvm_pkg. When calling these functions outside a derived class where these methods are not defined, it picks up the global definition. That global definition uses the report handler in uvm_top(uvm_root).

So you can either apply the report setting globally to uvm_top, or construct a log class inside the module for each module instance.

module my_checker;
  `include "uvm_macros.svh"
  import uvm_pkg::*;
  
  initial #1 
    `uvm_error ("CHECKER", "intr_assert failed")
  
  uvm_report_object log = new($sformatf("%m"));
  initial #2 
    `uvm_error_context ("CHECKER", "intr_assert failed",log)

endmodule
  
module top;
  import uvm_pkg::*;

  my_checker c1();
  my_checker c2();
    
  
  initial begin
    uvm_top.set_report_severity_id_override(UVM_ERROR, "CHECKER", UVM_WARNING);
    c1.log.set_report_severity_id_override(UVM_ERROR, "CHECKER", UVM_WARNING);
  end
endmodule