ML Reference
mlLogging.h File Reference
#include "mlUtilsSystem.h"
#include "mlTypeDefs.h"
#include <ThirdPartyWarningsDisable.h>
#include <sstream>
#include <ThirdPartyWarningsRestore.h>

Go to the source code of this file.

Namespaces

namespace  ml
 Main documentation file for ML users and developers.
 

Macros

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. The error code is an optional second argument. If it is omitted, ML_BAD_PARAMETER is used.

Example:

if (outIndex<0) {
mlError("SomeClass::SomeMethod", ML_BAD_PARAMETER) << "returning NULL, excepted outIndex>=0, but got outIndex==" << outIndex;
}
if (outIndex>3) {
mlError("SomeClass::SomeMethod") << "returning NULL, excepted outIndex<=3, but got outIndex==" << outIndex;
}
#define ML_BAD_PARAMETER
A bad/invalid parameter (or even an inappropriate image) has been passed to a module or an algorithm;...
Definition mlTypeDefs.h:823
#define mlError(FUNCTION,...)
Logs an error for FUNCTION with optional MLErrorCode.
Definition mlLogging.h:52
#define mlFatalError(FUNCTION, ...)    ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_FATAL, ML_NAMESPACE::internal::LogCollector::getErrorCode(__VA_ARGS__) ,FUNCTION).getStream()
 Logs a fatal error for FUNCTION with optional MLErrorCode.
 
#define mlError(FUNCTION, ...)    ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_ERROR, ML_NAMESPACE::internal::LogCollector::getErrorCode(__VA_ARGS__) , FUNCTION).getStream()
 Logs an error for FUNCTION with optional MLErrorCode.
 
#define mlWarning(FUNCTION, ...)    ML_NAMESPACE::internal::LogCollector(__FILE__, __LINE__, ML_WARNING, ML_NAMESPACE::internal::LogCollector::getErrorCode(__VA_ARGS__) , FUNCTION).getStream()
 Logs a warning for FUNCTION with optional MLErrorCode.
 
#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()).