The class ErrorOutput
is the central error
handle and redirection class for the ML. It contains a set of methods to
print debug and tracing information, warnings, errors and fatal errors,
and to configure a lot of error and message output settings, to specify
special behavior (e.g., aborting) on some message types and much more. It
also offers a registration mechanism where the application can register
itself to be notified when an error, tracing, warning or debug
information is to be printed or handled. They permit to register
functions to notify the application, to control a set of debug
environment variables, etc.
The ML provides a global instance
MLErrorOutput
of this class which is normally
used by debug and error handling macros as well as by the ML API (see
Section 6.3, “mlAPI.h”). You do not have to create an instance on your
own.
Note | |
---|---|
Usually, you should not use this class directly. Since this class is subject to change, use debug or error handling macros instead. If you need to configure the error handling system e.g., for
your application, use the |
mlErrorOutput.h
and
mlErrorOutputInfos.h
for detailed information on
how to use the following methods.The class ErrorOutput
offers methods
to
specify what the ML shall do on debug messages, (fatal) errors, etc.
void setTerminationType(MLMessageType level, MLTerminator term);
MLTerminator getTerminationType(MLMessageType level) const;
specify a filter to suppress any type of undesired messages (e.g., debug infos, std::cout, std::cerr or other messages)
void setMessageFilter(unsigned int messageType);
unsigned int getMessageFilter();
install a dump callback function that is called when any error occurs on a runtime type. It permits dumping a runtime typed object as a string into the error message:
void setDumpCB(DumpCB *dumpCB);
DumpCB *getDumpCB() const;
enable/disable debug message handling:
void setFullDebuggingOn(bool on);
bool isFullDebuggingOn() const;
manage registered callback functions that will be called when messages are sent to this class:
void addErrorOutputCB(void *userData, ErrorOutputCB *callback);
void removeErrorOutputCB(void *userData, ErrorOutputCB *callback);
bool hasErrorOutputCB(void *userData, ErrorOutputCB *callback) const;
void removeAllErrorOutputCBs();
unsigned long getNumOutputCBs() const;
manage a set of debug symbols (also see Section 5.1, “Printing Debug Information”):
void addDebugEnvName(const std::string &envName);
void removeDebugEnvName(const std::string &envName);
bool hasDebugEnvName(const std::string &envName) const;
const std::vector<std::string> &getDebugEnvNames() const;
void removeAllDebugEnvNames();
unsigned long getNumDebugEnvNames() const;
suppress std::cout and std::cerr prints to the standard console outputs:
bool areMessagesSentToCout() const;
void sendMessagesToCout(bool on);
bool areMessagesSentToCerr() const;
void sendMessagesToCerr(bool on);
send messages to an instance of this class that are used by debug and error handling macros (see also Section 5.2, “Handling Errors” and Section 5.1, “Printing Debug Information”):
void printAndNotify(...) const;
void handleDebugPrint(...) const;
configures and returns which message types shall be dumped:
size_t getTraceDumpMessageBits() const;
void setTraceDumpMessageBits(MLuint32 bitMask);
configure the length of the list of recently called functions and when to dump the current call stack into the registered error handling callbacks (see also TracingAndExceptionHandling):
size_t getMaxNumTraceListDumps() const;
void setMaxNumTraceListDumps(MLGlobalTraceBufferType num);
size_t getMaxNumTraceStackDumps() const;
void setMaxNumTraceStackDumps(MLGlobalTraceBufferType num);
© 2024 MeVis Medical Solutions AG