Logging and Error Handling
The C++ subengine defines the following logging levels:
- INFO
- DEBUG
- WARNING
- ERROR
- FATAL
The engine is in the debug mode when the debug tracing is enabled for the main engine. The
debug messages are printed only when the engine is in the debug mode.
To log a single string, use the v2_log_<level>_string set of function that are declared in v2/subengine.h.
For convenience, the variadic functions (such as, printf-like) are declared and implemented in
the optional v2/log.h header. If you want to include their
implementation in your operator library, then before including v2/log.h
in a source file, define the V2_LOG_IMPLEMENTATION macro.
For
example:
#define V2_LOG_IMPLEMENTATION #include <v2/log.h> #undef V2_LOG_IMPLEMENTATION
This helps to include the header from multiple files at wherever those function declarations are required, and still continue to keep their implementation in a single place.