ML Reference
Logging Macros

Macros that can be used for logging of errors/warnings and information strings. More...

Macros to print debug information.

#define mlDebugConst(ENV_VAR, COUTS)   _mlDebugConst(ENV_VAR, COUTS)
 Public macro to be used instead of print debug information.
#define mlDebug(COUTS)
 This macro prints debug information given by COUTS.
#define mlDebugConditional(COND_SYM, COUTS)
 Macro to specify subsets of debug outputs for a debug symbol which is given by the runtime type of the class.
#define mlDebugPrint(COUTS)   _mlDebugConst(ML_DEBUG_ENV_NAME, COUTS)
 Macro for printing debug information.
#define mlDebugClass(CLASS_NAME, COUTS)
 Macro for printing debug information.

Public macros to handle (fatal) errors, warnings, information and trace log information.

#define ML_PRINT_FATAL_ERROR(FUNC_NAME, REASON, HANDLING)   _ML_PRINT_FATAL_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, NULL, NULL)
 Like ML_PRINT_FATAL_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) without a runtime object to be dumped.
#define ML_PRINT_ERROR(FUNC_NAME, REASON, HANDLING)   _ML_PRINT_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, NULL, NULL)
 Like ML_PRINT_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) without a runtime object to be dumped.
#define ML_PRINT_WARNING(FUNC_NAME, REASON, HANDLING)   _ML_PRINT_WARNING_DUMP(FUNC_NAME, REASON, HANDLING, NULL, NULL)
 Like ML_PRINT_WARNING_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) without a runtime object to be dumped.
#define ML_PRINT_INFORMATION(FUNC_NAME, REASON, HANDLING)   _ML_PRINT_INFORMATION_DUMP(FUNC_NAME, REASON, HANDLING, NULL, NULL)
 Like ML_PRINT_INFORMATION_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) without a runtime object to be dumped.
#define ML_PRINT_INFO(FUNC_NAME, HANDLING)   _ML_PRINT_INFORMATION_DUMP(FUNC_NAME, ML_RESULT_OK, HANDLING, NULL, NULL)
 Convenience version of ML_PRINT_INFORMATION(FUNC_NAME, REASON, HANDLING) with REASON = ML_RESULT_OK.

Public macros for logging errors, warnings and information messages

Each of the macros returns an ostream which allows to pipe additional details into the message.

These macros are equivalent to the older ML_PRINT_* macros which only took a string for the message details.

Example:

 if (outIndex<0) {
   mlError("SomeClass::SomeMethod", ML_BAD_PARAMETER) << "returning NULL, excepted outIndex>=0, but got outIndex==" << outIndex; 
 }
#define mlFatalError(FUNCTION, ERRORCODE)   ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_FATAL, ERRORCODE, FUNCTION).getStream()
 Logs a fatal error for FUNCTION with MLErrorCode ERRORCODE.
#define mlError(FUNCTION, ERRORCODE)   ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_ERROR, ERRORCODE, FUNCTION).getStream()
 Logs an error for FUNCTION with MLErrorCode ERRORCODE.
#define mlWarning(FUNCTION, ERRORCODE)   ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_WARNING, ERRORCODE, FUNCTION).getStream()
 Logs a warning for FUNCTION with MLErrorCode ERRORCODE.
#define mlInfo(FUNCTION)   ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_INFORMATION, ML_RESULT_OK, FUNCTION).getStream()
 Logs an informational message.
#define mlFatalErrorWithDump(FUNCTION, ERRORCODE, OBJECT)   ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_FATAL, ERRORCODE, FUNCTION, (OBJECT), ML_NAMESPACE::internal::MLSecureGetRuntimeTypeId((OBJECT))).getStream()
 Logs a fatal error for FUNCTION with MLErrorCode ERRORCODE and additionally dumps the given OBJECT (which needs to support getTypeId()).
#define mlErrorWithDump(FUNCTION, ERRORCODE, OBJECT)   ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_ERROR, ERRORCODE, FUNCTION, (OBJECT), ML_NAMESPACE::internal::MLSecureGetRuntimeTypeId((OBJECT))).getStream()
 Logs an error for FUNCTION with MLErrorCode ERRORCODE and additionally dumps the given OBJECT (which needs to support getTypeId()).
#define mlWarningWithDump(FUNCTION, ERRORCODE, OBJECT)   ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_WARNING, ERRORCODE, FUNCTION, (OBJECT), ML_NAMESPACE::internal::MLSecureGetRuntimeTypeId((OBJECT))).getStream()
 Logs a warning for FUNCTION with MLErrorCode ERRORCODE and additionally dumps the given OBJECT (which needs to support getTypeId()).
#define mlInfoWithDump(FUNCTION, OBJECT)   ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_INFORMATION, ML_RESULT_OK, FUNCTION, (OBJECT), ML_NAMESPACE::internal::MLSecureGetRuntimeTypeId((OBJECT))).getStream()
 Logs an informational message for FUNCTION and additionally dumps the given OBJECT (which needs to support getTypeId()).

Detailed Description

Macros that can be used for logging of errors/warnings and information strings.


Define Documentation

#define ML_PRINT_FATAL_ERROR (   FUNC_NAME,
  REASON,
  HANDLING 
)    _ML_PRINT_FATAL_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, NULL, NULL)
#define ML_PRINT_INFO (   FUNC_NAME,
  HANDLING 
)    _ML_PRINT_INFORMATION_DUMP(FUNC_NAME, ML_RESULT_OK, HANDLING, NULL, NULL)

Convenience version of ML_PRINT_INFORMATION(FUNC_NAME, REASON, HANDLING) with REASON = ML_RESULT_OK.

Have a look at mlInfo for new style logging.

Definition at line 697 of file mlErrorMacros.h.

#define ML_PRINT_INFORMATION (   FUNC_NAME,
  REASON,
  HANDLING 
)    _ML_PRINT_INFORMATION_DUMP(FUNC_NAME, REASON, HANDLING, NULL, NULL)

Like ML_PRINT_INFORMATION_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) without a runtime object to be dumped.

Have a look at mlInfo for new style logging.

Definition at line 689 of file mlErrorMacros.h.

#define ML_PRINT_WARNING (   FUNC_NAME,
  REASON,
  HANDLING 
)    _ML_PRINT_WARNING_DUMP(FUNC_NAME, REASON, HANDLING, NULL, NULL)

Like ML_PRINT_WARNING_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) without a runtime object to be dumped.

Have a look at mlWarning for new style logging.

Definition at line 680 of file mlErrorMacros.h.

#define mlDebug (   COUTS)

This macro prints debug information given by COUTS.

It requires that the class has the runtime type system implemented. So it accesses the type id and creates the debug symbol by using 'ML_' + the class name. This is the normal macro used in implementations of ML modules. See header documentation for more information about debug printing.

Parameters:
COUTSThe stream output redirected to the MLErrorOutput instance if the corresponding debug symbol is activated.

Definition at line 130 of file mlDebug.h.

#define mlDebugClass (   CLASS_NAME,
  COUTS 
)

Macro for printing debug information.

It requires that the class CLASS_NAME has the runtime type system implemented. So it accesses the type id and creates debug environment name. See header documentation for more information about debug printing.

Parameters:
CLASS_NAMEThe class type used to generate the debug symbol on which the output of COUTS is activated.
COUTSThe stream output sent to the error/debug output if the debug symbol created from CLASS_NAME is activated.

Definition at line 204 of file mlDebug.h.

#define mlDebugConditional (   COND_SYM,
  COUTS 
)

Macro to specify subsets of debug outputs for a debug symbol which is given by the runtime type of the class.

It prints debug information in two different cases:

  • If the class name (given by the runtime type) is specified as symbol or
  • If the class name + "-" + COND_SYM is specified.

E.g., if the following macro is used in the class "MyModule":

    mlDebugConditional("CASES", "Message1");  

the debug information "Message1" is printed if the debug symbol "ML_MYMODULE" is defined or if the the debug symbol "ML_MYMODULE-CASES" is specified. If only "ML_MYMODULE-CASES" is specified then only "Message1" is printed but nothing else from class MyModule.

This macro requires that the class in which it is used has the runtime type system implemented. So it accesses the type id and creates debug environment name from it. See header documentation for more information about debug printing.

Parameters:
COND_SYMspecifies the additional symbol added to the class symbol (separated by a "-")
COUTSThe stream output sent to the error/debug output if the symbol given by the class name + "-" + COND_SYM is activated.

Definition at line 172 of file mlDebug.h.

#define mlDebugConst (   ENV_VAR,
  COUTS 
)    _mlDebugConst(ENV_VAR, COUTS)

Public macro to be used instead of print debug information.

See header documentation of this file for full documentation.

Definition at line 110 of file mlDebug.h.

#define mlDebugPrint (   COUTS)    _mlDebugConst(ML_DEBUG_ENV_NAME, COUTS)

Macro for printing debug information.

It uses the ML_DEBUG_ENV_VAR as name of the class to be debugged. ML_DEBUG_ENV_VAR is required to be defined. Useful for classes which do not have a runtime interface. See header documentation for more information about debug printing.

Parameters:
COUTSThe stream output sent to the error/debug output if the symbol defined in ML_DEBUG_ENV_NAME is activated.

Definition at line 184 of file mlDebug.h.

#define mlError (   FUNCTION,
  ERRORCODE 
)    ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_ERROR, ERRORCODE, FUNCTION).getStream()

Logs an error for FUNCTION with MLErrorCode ERRORCODE.

Definition at line 46 of file mlLogging.h.

#define mlErrorWithDump (   FUNCTION,
  ERRORCODE,
  OBJECT 
)    ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_ERROR, ERRORCODE, FUNCTION, (OBJECT), ML_NAMESPACE::internal::MLSecureGetRuntimeTypeId((OBJECT))).getStream()

Logs an error for FUNCTION with MLErrorCode ERRORCODE and additionally dumps the given OBJECT (which needs to support getTypeId()).

Definition at line 65 of file mlLogging.h.

#define mlFatalError (   FUNCTION,
  ERRORCODE 
)    ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_FATAL, ERRORCODE, FUNCTION).getStream()

Logs a fatal error for FUNCTION with MLErrorCode ERRORCODE.

Definition at line 41 of file mlLogging.h.

#define mlFatalErrorWithDump (   FUNCTION,
  ERRORCODE,
  OBJECT 
)    ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_FATAL, ERRORCODE, FUNCTION, (OBJECT), ML_NAMESPACE::internal::MLSecureGetRuntimeTypeId((OBJECT))).getStream()

Logs a fatal error for FUNCTION with MLErrorCode ERRORCODE and additionally dumps the given OBJECT (which needs to support getTypeId()).

Definition at line 61 of file mlLogging.h.

#define mlInfo (   FUNCTION)    ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_INFORMATION, ML_RESULT_OK, FUNCTION).getStream()

Logs an informational message.

Definition at line 56 of file mlLogging.h.

#define mlInfoWithDump (   FUNCTION,
  OBJECT 
)    ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_INFORMATION, ML_RESULT_OK, FUNCTION, (OBJECT), ML_NAMESPACE::internal::MLSecureGetRuntimeTypeId((OBJECT))).getStream()

Logs an informational message for FUNCTION and additionally dumps the given OBJECT (which needs to support getTypeId()).

Definition at line 73 of file mlLogging.h.

#define mlWarning (   FUNCTION,
  ERRORCODE 
)    ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_WARNING, ERRORCODE, FUNCTION).getStream()

Logs a warning for FUNCTION with MLErrorCode ERRORCODE.

Definition at line 51 of file mlLogging.h.

#define mlWarningWithDump (   FUNCTION,
  ERRORCODE,
  OBJECT 
)    ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_WARNING, ERRORCODE, FUNCTION, (OBJECT), ML_NAMESPACE::internal::MLSecureGetRuntimeTypeId((OBJECT))).getStream()

Logs a warning for FUNCTION with MLErrorCode ERRORCODE and additionally dumps the given OBJECT (which needs to support getTypeId()).

Definition at line 69 of file mlLogging.h.