DriveWorks SDK Reference
5.10.90 Release
For Test and Development only

Logging

The NVDIA® DriveWorks library implements simple logging, by passing a log message to a user-specified callback.

To initialize a logger instance, pass a callback method to the logger initialization. The call must occur before SDK context initialization. For more information, see Core Logger.

// initialize global logger instance to push all logs to the given callback
dwLogger_initialize(myLoggerCallback());
// log everything above WARN level, i.e. WARN and ERROR
dwContextParameters sdkParams = {};
dwVersion sdkVersion;
dwGetVersion(&sdkVersion);
dwInitialize(&sdk, sdkVersion, &sdkParams);
DW_API_PUBLIC dwStatus dwInitialize(dwContextHandle_t *const context, dwVersion const headerVersion, dwContextParameters const *const params)
Creates and initializes an SDK context.
A set of parameters that is passed to the SDK to create the context.
Definition: Context.h:93
DW_API_PUBLIC dwStatus dwLogger_initialize(dwLogCallback msgCallback)
Creates a new logger instance.
DW_API_PUBLIC dwStatus dwLogger_setLogLevel(dwLoggerVerbosity const verbosity)
Sets the verbosity level of the logger instance.
@ DW_LOG_WARN
Log Warning information.
Definition: Logger.h:76
DW_API_PUBLIC dwStatus dwGetVersion(dwVersion *const version)
Query the current DriveWorks library version.
Note
Currently, logger is a global instance and is not bound to a specific SDK context.

A callback method that accepts log messages has the following syntax:

void myLoggerCallback(dwContextHandle_t context, dwLoggerVerbosity type, const char* msg)
{
...
}
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:83
dwLoggerVerbosity
Holds the verbosity level.
Definition: Logger.h:72