NilsLS Posted July 31 Report Share Posted July 31 Hi, the macros SC_REPORT_INFO and SC_REPORT_INFO_VERB (in sc_report.h) call the handler's report function with file and line number arguments: #define SC_REPORT_INFO_VERB( msg_type , msg, verbosity ) \ sc_report_handler::report( SC_INFO , msg_type , msg , verbosity, __FILE__ , __LINE__ ) But when composing the message, the handler only adds file and line to the message string if the severity is larger than SC_INFO in sc_report_handler.cpp: const std::string sc_report_compose_message(const sc_report& rep) { ... if( rep.get_severity() > SC_INFO ) { char line_number_str[16]; str += "\nIn file: "; str += rep.get_file_name(); str += ":"; std::sprintf(line_number_str, "%d", rep.get_line_number()); str += line_number_str; sc_simcontext* simc = sc_get_curr_simcontext(); ... So effectively these macros never print file and line number. Is there a specific reason why file and line info is left out for info messages? It is very explicit in this code, so we are wondering what might break by enabling it. Or is this just an oversight and nobody cared so far? thanks, Nils Quote Link to comment Share on other sites More sharing options...
Eyck Posted July 31 Report Share Posted July 31 I cannot really answer your question but, in my experience the INFO level is used to report normal execution or debugging information during normal execution. Therefore the file name and line number can be ommited. In any case, you are free to register your own handler. One example of this would be https://github.com/Minres/SystemC-Components/blob/main/src/sysc/scc/report.cpp#L277 which formats the output in a tabular fashion, adds the time and SystemC hierarchy of the unit issueing the log message, and uses a more efficient printing based on spdlog and fmt. The registration of the custom handler can be seen at https://github.com/Minres/SystemC-Components/blob/main/src/sysc/scc/report.cpp#L380. David Black 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.