DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

Logging
Note
SW Release Applicability: This tutorial is applicable to modules in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.

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);
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)
{
...
}