ATLAS Offline Software
Control/AthToolSupport/AsgMessaging/AsgMessaging/MsgStreamMacros.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ASGMESSAGING_MSGSTREAMMACROS_H
6 #define ASGMESSAGING_MSGSTREAMMACROS_H
7 
8 // Local include(s):
10 
11 // Pull in the definition from Athena:
12 #ifndef XAOD_STANDALONE
14 #else // not XAOD_STANDALONE
15 
17 
18 // Not sure why this is needed...
19 #undef ERROR
20 
21 // This is a GCC extension for getting the name of the current function.
22 #if defined( __GNUC__ )
23 # define MSGSTREAM_FNAME CxxUtils::normalizeFunctionName(__PRETTY_FUNCTION__)
24 #else
25 # define MSGSTREAM_FNAME ""
26 #endif
27 
35 #define MSGSTREAM_REPORT_PREFIX \
36  __FILE__ << ":" << __LINE__ << " (" << MSGSTREAM_FNAME << "): "
37 
39 #define ATH_MSG_LVL_SERIOUS( lvl, xmsg ) \
40  msg( lvl ) << MSGSTREAM_REPORT_PREFIX << xmsg << endmsg
41 
43 #define ATH_MSG_LVL_NOCHK( lvl, xmsg ) \
44  msg( lvl ) << xmsg << endmsg
45 
47 #define ATH_MSG_LVL( lvl, xmsg ) \
48  do { \
49  if( msg().msgLevel( lvl ) ) { \
50  ATH_MSG_LVL_NOCHK( lvl, xmsg ); \
51  } \
52  } while( 0 )
53 
55 #define ATH_MSG_VERBOSE( xmsg ) ATH_MSG_LVL( MSG::VERBOSE, xmsg )
56 #define ATH_MSG_DEBUG( xmsg ) ATH_MSG_LVL( MSG::DEBUG, xmsg )
58 #define ATH_MSG_INFO( xmsg ) ATH_MSG_LVL_NOCHK( MSG::INFO, xmsg )
60 #define ATH_MSG_WARNING( xmsg ) ATH_MSG_LVL_NOCHK( MSG::WARNING, xmsg )
62 #define ATH_MSG_ERROR( xmsg ) ATH_MSG_LVL_SERIOUS( MSG::ERROR, xmsg )
64 #define ATH_MSG_FATAL( xmsg ) ATH_MSG_LVL_SERIOUS( MSG::FATAL, xmsg )
66 #define ATH_MSG_ALWAYS( xmsg ) ATH_MSG_LVL_NOCHK( MSG::ALWAYS, xmsg )
68 
70 #define ATH_MSG(lvl) \
71  if( msg().msgLevel( MSG::lvl ) ) msg(MSG::lvl)
72 
73 #endif // not XAOD_STANDALONE
74 #endif // ASGMESSAGING_MSGSTREAMMACROS_H
AthMsgStreamMacros.h
normalizeFunctionName.h
Normalize a pretty-printed C++ function name,.
MsgLevel.h
Definition of message levels and a helper function.