13#ifndef ML_ERROR_OUTPUT_H
14#define ML_ERROR_OUTPUT_H
27ML_UTILS_START_NAMESPACE
55ML_UTILS_START_NAMESPACE
60 class ErrorOutputInfos;
378 const std::string &libraryPrefix,
379 const std::string &fPrefix,
380 const std::string &functionName,
381 const std::string &reason,
382 const std::string &handling =
"",
383 const std::string &file =
"",
385 const void *dumpObj =
nullptr,
393 const std::string &libraryPrefix,
394 const std::string &fPrefix,
395 const std::string &functionName,
397 const std::string &handling =
"",
398 const std::string &file =
"",
400 const void *dumpObj =
nullptr,
415 const std::string &libraryPrefix,
416 std::stringstream &reason,
432 const std::string &libraryPrefix,
443 friend class ML_NAMESPACE::State;
460 void _printConsole(
const std::string &errStr,
const ErrorOutputInfos &infos)
const;
465 std::string getTraceDump()
const;
470 std::streambuf *_defaultCoutBuffer;
475 std::streambuf *_defaultCerrBuffer;
489 bool _isFullDebuggingOn;
537 std::vector<void*> _errorUserDataList;
540 std::vector<ErrorOutputCB*> _errorOutputCBList;
543 std::vector<std::string> _debugEnvStrings;
552 bool _outputMessagesInVisualStudio;
560ML_UTILS_END_NAMESPACE
Class to handle all ML debug prints, errors, warnings, and information.
void sendMessagesToCout(bool on)
size_t getNumOutputCBs() const
Returns the number of registered callbacks.
ErrorOutput(const ErrorOutput &errorOutput)
Copy constructor, only to be used by state class of the ML.
void setFullDebuggingOn(bool on)
Enables/disables full debugging by passing true or false as on.
MLTerminator getTerminationType(MLMessageType level) const
Returns the way how the ML shall handle messages.
char * DumpCB(const void *dumpObj, const RuntimeType *dumpObjRT)
bool hasErrorOutputCB(void *userData, ErrorOutputCB *callback) const
MLuint32 getTraceDumpMessageBits() const
void removeAllErrorOutputCBs()
ErrorOutput()
Constructor.
void setOutputMessagesInVisualStudio(bool flag)
Sets whether messages should be printed in Visual Studio (turned on by default in debug mode).
~ErrorOutput()
Destructor.
void addDebugEnvName(const std::string &envName)
Adds a debug environment string whose information shall be printed.
void setMaxNumTraceListDumps(MLGlobalTraceBufferType num)
Sets the maximum number of trace list entries to be shown on fatal error outputs.
const std::vector< std::string > & getDebugEnvNames() const
Returns a list of debug environment names.
bool areMessagesSentToCout() const
Messages are only sent to std::cout if this flag is true.
bool areMessagesSentToCerr() const
Messages are only sent to std::cerr if this flag is true.
void sendMessagesToCerr(bool on)
void setDumpCB(DumpCB *dumpCB)
void removeDebugEnvName(const std::string &envName)
Removes a registered debug environment string whose information shall not be printed anymore.
size_t getNumDebugEnvNames() const
Returns the number of registered debug environment names.
void setTerminationType(MLMessageType level, MLTerminator term)
void addErrorOutputCB(void *userData, ErrorOutputCB *callback)
DumpCB * getDumpCB() const
Returns the currently registered dump callback. Default is NULL.
bool hasDebugEnvName(const std::string &envName) const
Returns true if the debug environment name exists.
void setMessageFilter(MLuint32 messageType)
bool shouldOutputMessagesInVisualStudio() const
Returns wheter messages should be printed in Visual Studio.
MLuint32 getMaxNumTraceStackDumps() const
Returns the maximum number of trace stack entries to be shown on fatal error outputs.
void removeErrorOutputCB(void *userData, ErrorOutputCB *callback)
void ErrorOutputCB(void *usrData, const char *errStr, const ErrorOutputInfos &infos)
void removeAllDebugEnvNames()
MLuint32 getMessageFilter()
void setMaxNumTraceStackDumps(MLGlobalTraceBufferType num)
Sets the maximum number of trace stack entries to be shown on fatal error outputs.
void setTraceDumpMessageBits(MLuint32 bitMask)
MLuint32 getMaxNumTraceListDumps() const
Returns the maximum number of trace list entries to be shown on fatal error outputs.
void reset()
Resets instance to construction state.
bool isFullDebuggingOn() const
Returns true if full debugging is enabled; otherwise, it returns false.
ErrorOutput & operator=(const ErrorOutput &errorOutput)
Assignment operator, only to be used by state class of the ML.
MLint32 MLErrorCode
Type of an ML Error code.
#define ML_RESULT_OK
No error. Everything seems to be okay.
void printAndNotify(MLMessageType messageType, const std::string &libraryPrefix, const std::string &fPrefix, const std::string &functionName, const std::string &reason, const std::string &handling="", const std::string &file="", int line=-1, const void *dumpObj=nullptr, const RuntimeType *dumpObjRT=nullptr, MLErrorCode errCode=ML_RESULT_OK) const
boost::recursive_mutex RecursiveMutex
void handleDebugPrint(const std::string &envVar, const std::string &libraryPrefix, const char *reason, const char *file, int line) const
void handleDebugPrint(const std::string &envVar, const std::string &libraryPrefix, std::stringstream &reason, const char *file, int line) const
void printAndNotify(MLMessageType messageType, const std::string &libraryPrefix, const std::string &fPrefix, const std::string &functionName, MLErrorCode reason, const std::string &handling="", const std::string &file="", int line=-1, const void *dumpObj=nullptr, const RuntimeType *dumpObjRT=nullptr) const
MLTerminator
Termination types for error handling.
MLMessageType
Message types handled by the ErrorOutput class.
ML_UTILS_EXPORT ErrorOutput MLErrorOutput
This is a singleton used for all ML Error input and output;.
MLuint16 MLGlobalTraceBufferType
The type used in the MLGlobalTraceBuffer.
MLEXPORT std::ostream & operator<<(std::ostream &s, const ml::Field &v)
Overloads the operator '<<' for stream output of Field objects.