ATLAS Offline Software
|
Helper class to use to report a message. More...
#include <errorcheck.h>
Public Member Functions | |
ReportMessage (MSG::Level level, int line, const char *file, const char *func, const char *pkg, const std::string &context, StatusCode sc) | |
Constructor. More... | |
ReportMessage (MSG::Level level, int line, const char *file, const char *func, const char *pkg, const std::string &context) | |
Constructor. More... | |
~ReportMessage () | |
Destructor. More... | |
virtual MsgStream & | doOutput () |
Emit the message. More... | |
MsgStream & | msgstream () |
Convert to a MsgStream reference. More... | |
Static Public Member Functions | |
static void | hideErrorLocus (bool flag=true) |
If set to true, hide the source file and line number in the output. More... | |
static void | hideFunctionNames (bool flag=true) |
If set to true, hide function names in the output. More... | |
Private Member Functions | |
void | format_common (MSG::Level level, int line, const char *file, const char *func, const char *pkg) |
Generate the common header for messages. More... | |
Private Attributes | |
std::string::size_type | m_pos |
The position in the output message after the standard header. More... | |
Static Private Attributes | |
static std::atomic< bool > | s_hide_error_locus |
If true, hide the source file and line number in output messages. More... | |
static std::atomic< bool > | s_hide_function_names |
If true, hide the function names in output messages. More... | |
Helper class to use to report a message.
To report a message, create an instance of this class. A standard header, containing the file/line, context name, and so forth, is automatically put at the start of the message. More text may be added using the standard MsgStream
streaming operators. The message is actually emitted when this object is destroyed.
Definition at line 171 of file Control/AthenaKernel/AthenaKernel/errorcheck.h.
errorcheck::ReportMessage::ReportMessage | ( | MSG::Level | level, |
int | line, | ||
const char * | file, | ||
const char * | func, | ||
const char * | pkg, | ||
const std::string & | context, | ||
StatusCode | sc | ||
) |
Constructor.
level | The error logging level for the message. |
line | The source line from which the report is being made. |
file | The source file name from which the report is being made. |
func | The name of the function from which the report is being made. |
pkg | The name of the package from which the report is being made. |
context | The name of the context (algorithm/tool/service/etc.) from which the report is being made. |
sc | The StatusCode to include in the error message. |
Definition at line 64 of file errorcheck.cxx.
errorcheck::ReportMessage::ReportMessage | ( | MSG::Level | level, |
int | line, | ||
const char * | file, | ||
const char * | func, | ||
const char * | pkg, | ||
const std::string & | context | ||
) |
Constructor.
level | The error logging level for the message. |
line | The source line from which the report is being made. |
file | The source file name from which the report is being made. |
func | The name of the function from which the report is being made. |
pkg | The name of the package from which the report is being made. |
context | The name of the context (algorithm/tool/service/etc.) from which the report is being made. |
Definition at line 94 of file errorcheck.cxx.
errorcheck::ReportMessage::~ReportMessage | ( | ) |
Destructor.
This will cause the message to be emitted, if it hasn't already been.
Definition at line 152 of file errorcheck.cxx.
|
virtual |
Emit the message.
We override this method from MsgStream
in order to fix up the message punctuation.
Definition at line 166 of file errorcheck.cxx.
|
private |
Generate the common header for messages.
level | The error logging level for the message. |
line | The source line from which the report is being made. |
file | The source file name from which the report is being made. |
func | The name of the function from which the report is being made. |
pkg | The name of the package from which the report is being made. |
Definition at line 118 of file errorcheck.cxx.
|
static |
If set to true, hide the source file and line number in the output.
This is intended for use in regression tests, where it's undesirable to have the output change if source lines are added or deleted.
Definition at line 197 of file errorcheck.cxx.
|
static |
If set to true, hide function names in the output.
in the output.
This is intended for use in regression tests, where function names may be formatted differently on different platforms.
Definition at line 211 of file errorcheck.cxx.
|
inline |
Convert to a MsgStream
reference.
Trying to use a ReportMessage
like
doesn't work, because (as of Gaudi 19) the MsgStream
inserters are written as free functions:
and the non-const MsgStream
reference won't bind to the temporary. We can work around this problem with this method, which will convert the temporary to a non-const reference. So, this should work:
Definition at line 251 of file Control/AthenaKernel/AthenaKernel/errorcheck.h.
|
private |
The position in the output message after the standard header.
Definition at line 292 of file Control/AthenaKernel/AthenaKernel/errorcheck.h.
|
staticprivate |
If true, hide the source file and line number in output messages.
Definition at line 295 of file Control/AthenaKernel/AthenaKernel/errorcheck.h.
|
staticprivate |
If true, hide the function names in output messages.
Definition at line 298 of file Control/AthenaKernel/AthenaKernel/errorcheck.h.