DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

Core Logger

Detailed Description

Processes wide logger API.

Unless explicitly specified, all errors returned by DriveWorks APIs are non recoverable and the user application should transition to fail safe mode. In addition, any error code not described in this documentation should be consider as fatal and the user application should also transition to fail safe mode.

Typedefs

typedef void(* dwLogCallback) (dwContextHandle_t context, dwLoggerVerbosity type, const char8_t *msg)
 Defines a user callback method called by the SDK to log the output. More...
 

Enumerations

enum  dwLoggerVerbosity {
  DW_LOG_VERBOSE = 0x0000,
  DW_LOG_DEBUG = 0x1000,
  DW_LOG_INFO = 0x2000,
  DW_LOG_WARN = 0x3000,
  DW_LOG_ERROR = 0x4000,
  DW_LOG_SILENT = 0x7000
}
 Holds the verbosity level. More...
 

Functions

DW_API_PUBLIC dwStatus dwLogger_enableTimestamps (bool enabled)
 Enable or disable logging of timestamps before each message. More...
 
DW_API_PUBLIC dwStatus dwLogger_initialize (dwLogCallback msgCallback)
 Creates a new logger instance. More...
 
DW_API_PUBLIC dwStatus dwLogger_log (dwContextHandle_t context, dwLoggerVerbosity verbosity, const char8_t *msg)
 Logs message. More...
 
DW_API_PUBLIC dwStatus dwLogger_release (void)
 Release logger instance and free up used memory. More...
 
DW_API_PUBLIC dwStatus dwLogger_setLogLevel (dwLoggerVerbosity verbosity)
 Sets the verbosity level of the logger instance. More...
 

Typedef Documentation

◆ dwLogCallback

typedef void(* dwLogCallback) (dwContextHandle_t context, dwLoggerVerbosity type, const char8_t *msg)

Defines a user callback method called by the SDK to log the output.

Parameters
[in]contextSpecifies the DriveWorks context that generated this message. It can be 'DW_NULL_HANDLE' if no context was available when the message was generated.
[in]typeSpecifies the type of message being logged.
[in]msgA pointer to the message.

Definition at line 84 of file Logger.h.

Enumeration Type Documentation

◆ dwLoggerVerbosity

Holds the verbosity level.

Enumerator
DW_LOG_VERBOSE 
DW_LOG_DEBUG 
DW_LOG_INFO 
DW_LOG_WARN 
DW_LOG_ERROR 
DW_LOG_SILENT 

Definition at line 67 of file Logger.h.

Function Documentation

◆ dwLogger_enableTimestamps()

DW_API_PUBLIC dwStatus dwLogger_enableTimestamps ( bool  enabled)

Enable or disable logging of timestamps before each message.

dwLogger is initialized with timestamps enabled.

Parameters
[in]enabledWhether to log timestamps (true) or not (false).
Returns
DW_SUCCESS

◆ dwLogger_initialize()

DW_API_PUBLIC dwStatus dwLogger_initialize ( dwLogCallback  msgCallback)

Creates a new logger instance.

Parameters
[in]msgCallbackSpecifies the callback method used by the SDK to pass log messages. It must be thread-safe.

return DW_INVALID_ARGUMENT if msgCallback is NULL. Provide a valid input parameter.
DW_FAILURE if the logger verbosity is invalid. Provide a valid verbosity level.
DW_SUCCESS

◆ dwLogger_log()

DW_API_PUBLIC dwStatus dwLogger_log ( dwContextHandle_t  context,
dwLoggerVerbosity  verbosity,
const char8_t msg 
)

Logs message.

Parameters
[in]contextSpecifies the DriveWorks context that generated this message.
[in]verbositySpecifies the verbosity level to use.
[in]msgSpecifies message which is to be logged.
Returns
DW_FAILURE
  • if verbosity is invalid. Provide a valid input parameter or
  • if the function clock_gettime() fails.
DW_SUCCESS

◆ dwLogger_release()

DW_API_PUBLIC dwStatus dwLogger_release ( void  )

Release logger instance and free up used memory.

Returns
DW_SUCCESS

◆ dwLogger_setLogLevel()

DW_API_PUBLIC dwStatus dwLogger_setLogLevel ( dwLoggerVerbosity  verbosity)

Sets the verbosity level of the logger instance.

Any messages with higher or equal verbosity level is forwarded to the logger callback.

Parameters
[in]verbositySpecifies the verbosity level to use.
Returns
DW_FAILURE if verbosity is invalid. Provide a valid verbosity level.
DW_SUCCESS