# Adjusting message format based on verbosity level

**URL:** <https://verificationacademy.com/forums/t/adjusting-message-format-based-on-verbosity-level/29568>\
**Category:** UVM\
**Tags:** UVM, UVM\_VERBOSITY, uvm\_report\_server, get\_report\_verbosity\_level\
**Created:** [June 9, 2014, 6:22pm UTC](https://verificationacademy.com/forums/t/adjusting-message-format-based-on-verbosity-level/29568 "2014-06-09T18:22:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonyle](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/tonyle/32/4451_2.png) [@tonyle](https://verificationacademy.com/forums/u/tonyle)\
**Post date:** [June 9, 2014, 6:22pm UTC](https://verificationacademy.com/forums/t/adjusting-message-format-based-on-verbosity-level/29568/1 "2014-06-09T18:22:57Z")

</div>

I’ve created my own subclass based on uvm\_report\_server and am trying to change the message format based on verbosity level. Specifically, I want to print file and object information only for UVM\_FATAL or UVM\_DEBUG. I heard about **get\_report\_verbosity\_level** but couldn’t find any examples of how to use it, so I tried the following but it does not print out the extra information when I set +UVM\_VERBOSITY=UVM\_DEBUG. If I take out the conditionals so that **baseline** and **verbose\_id** are always set, the extra info prints out fine. What am I doing wrong?

```verilog
class new_report_server extends uvm_report_server;
   static string filename_cache [string];

   function string compose_message( uvm_severity severity,
                                    string name,
                                    string id,
                                    string message,
                                    string filename,
                                    int line );
      string basefile;
      string verbose_id;
      string severity_name;

      uvm_severity_type severity_type = uvm_severity_type'(severity);

      //
      // Attempt to retrieve verbosity level
      //
      uvm_report_object dummy_report = new("");
      int verbosity_level = dummy_report.get_report_verbosity_level(severity, id); 

      //
      // Print the severity for any level above UVM_INFO
      //
      if (severity_type > UVM_INFO) begin
         severity_name = severity_type.name();
         severity_name = {" ",severity_name.substr(4,severity_name.len()-1),":"};
      end

      if ((severity_type >= UVM_FATAL) || (verbosity_level >= UVM_DEBUG)) begin
         if (filename_cache.exists(filename)) basefile = filename_cache[filename];
         else begin
            int i;

            basefile = filename;
            //
            // Remove any trailing slashes
            //
            i = basefile.len() - 1;
            while (i >= 0 && basefile.substr(i,i) == "/")
               basefile = basefile.substr(0, --i);

            //
            // Remove middle slashes
            //
            for (i = basefile.len() - 1; i >= 0; i--) begin
               if (basefile.substr(i,i) == "/") begin
                  basefile = basefile.substr(i+1,basefile.len()-1);
                  break;
               end
            end

            filename_cache[filename] = basefile;
         end
      end

      if (basefile != "")
         $swrite(verbose_id, " [%0s(%0d): %0s(%0s)]", basefile, line, name, id);

      return $psprintf( "[%12t] :%0s%0s %0s",
                        $time, severity_name, verbose_id, message );
   endfunction
   ...
endclass

```
