NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release

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.

Data Structures

struct  dwLoggerMessage
 
struct  dwSourceCodeLocation
 Where in the source code a particular log message originates. More...
 
struct  dwLogMessageInfo
 metatdata associated with a log message More...
 
struct  dwLogMessage
 a textual log message through, e.g., DW_LOG APIs More...
 

Typedefs

typedef struct dwContextObject * dwContextHandle_t
 The Driveworks context handle. More...
 
typedef struct dwContextObject const * dwConstContextHandle_t
 
typedef struct dwLoggerMessage dwLoggerMessage
 
typedef void(* dwLogCallback) (dwContextHandle_t context, dwLoggerVerbosity type, char8_t const *msg)
 Defines a user callback method called by the SDK to log the output. More...
 
typedef void(* dwLoggerCallback) (dwLoggerMessage const *msg)
 Defines a user callback method called by the SDK to log the output with meta-data. More...
 
typedef enum dwLoggerVerbosity dwLoggerVerbosity
 Holds the verbosity level. More...
 
typedef enum dwSizes dwSizes
 Holds the maximum sizes for various strings. More...
 
typedef struct dwSourceCodeLocation dwSourceCodeLocation
 Where in the source code a particular log message originates. More...
 
typedef struct dwLogMessageInfo dwLogMessageInfo
 metatdata associated with a log message More...
 
typedef struct dwLogMessage dwLogMessage
 a textual log message through, e.g., DW_LOG APIs More...
 

Enumerations

enum  dwLoggerVerbosity {
  DW_LOG_VERBOSE = 0,
  DW_LOG_DEBUG = 1 << 12,
  DW_LOG_INFO = 1 << 13,
  DW_LOG_WARN = (1 << 14) - 4096,
  DW_LOG_ERROR = 1 << 14,
  DW_LOG_FATAL = (1 << 14) + (1 << 12),
  DW_LOG_SILENT = (1 << 15) - 4096
}
 Holds the verbosity level. More...
 
enum  dwSizes {
  DW_LOGGER_SIZE_UNSPECIFIED = 0,
  DW_LOGGER_TAG_SIZE = 64,
  DW_LOGGER_FILE_NAME_SIZE = 256,
  DW_LOGGER_MESSAGE_SIZE = 512
}
 Holds the maximum sizes for various strings. More...
 

Functions

DW_API_PUBLIC dwStatus dwLogger_initialize (dwLogCallback msgCallback)
 Creates a new logger instance. More...
 
DW_API_PUBLIC dwStatus dwLogger_initializeExtended (dwLoggerCallback msgCallback)
 Creates a new logger instance that provides meta-data with the message. More...
 
DW_API_PUBLIC dwStatus dwLogger_setLogLevel (dwLoggerVerbosity const verbosity)
 Sets the verbosity level of the logger instance. More...
 
DW_API_PUBLIC dwStatus dwLogger_getLogLevel (dwLoggerVerbosity *verbosity)
 Gets the verbosity level of the logger instance. More...
 
DW_API_PUBLIC dwStatus dwLogger_enableTimestamps (bool const enabled)
 Enable or disable logging of timestamps before each message. More...
 
DW_API_PUBLIC dwStatus dwLogger_log (dwConstContextHandle_t const context, dwLoggerVerbosity const verbosity, char8_t const *const msg)
 Logs message. More...
 
DW_API_PUBLIC dwStatus dwLogger_logExtended (const dwLoggerMessage *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_setThreadId (char8_t const *threadId)
 Set the name of the current thread that will be returned when using extended logger. More...
 

Typedef Documentation

◆ dwConstContextHandle_t

typedef struct dwContextObject const* dwConstContextHandle_t

Definition at line 67 of file Logger.h.

◆ dwContextHandle_t

typedef struct dwContextObject* dwContextHandle_t

The Driveworks context handle.

Definition at line 66 of file Logger.h.

◆ dwLogCallback

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

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

Parameters
[in]contextDeprecated context pointer, set to DW_NULL_HANDLE. Should not be used
[in]typeSpecifies the type of message being logged.
[in]msgA pointer to the message.

Definition at line 86 of file Logger.h.

◆ dwLoggerCallback

typedef void(* dwLoggerCallback) (dwLoggerMessage const *msg)

Defines a user callback method called by the SDK to log the output with meta-data.

Parameters
[in]msgA struct containing message and meta-data

Definition at line 93 of file Logger.h.

◆ dwLoggerMessage

◆ dwLoggerVerbosity

Holds the verbosity level.

◆ dwLogMessage

typedef struct dwLogMessage dwLogMessage

a textual log message through, e.g., DW_LOG APIs

◆ dwLogMessageInfo

metatdata associated with a log message

◆ dwSizes

typedef enum dwSizes dwSizes

Holds the maximum sizes for various strings.

◆ dwSourceCodeLocation

Where in the source code a particular log message originates.

Enumeration Type Documentation

◆ dwLoggerVerbosity

Holds the verbosity level.

Enumerator
DW_LOG_VERBOSE 

Log everything; default log level.

DW_LOG_DEBUG 

Log Debug information.

DW_LOG_INFO 

Log Notice information.

DW_LOG_WARN 

Log Warning information.

DW_LOG_ERROR 

Log Error information.

DW_LOG_FATAL 

Log Fatal information which cause premature termination.

DW_LOG_SILENT 

Log nothing.

Definition at line 45 of file LoggerDefs.h.

◆ dwSizes

enum dwSizes

Holds the maximum sizes for various strings.

Enumerator
DW_LOGGER_SIZE_UNSPECIFIED 

This is just here to make proto policy rules happy.

DW_LOGGER_TAG_SIZE 

The maximum number of characters in either a tag or thread id string (including null terminator)

DW_LOGGER_FILE_NAME_SIZE 

The maximum number of characters in a file name string (including null terminator)

DW_LOGGER_MESSAGE_SIZE 

The maximum number of characters in a log message string (including null terminator)

Definition at line 60 of file LoggerDefs.h.

Function Documentation

◆ dwLogger_enableTimestamps()

DW_API_PUBLIC dwStatus dwLogger_enableTimestamps ( bool const  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).
Return values
DW_SUCCESSalways.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwLogger_getLogLevel()

DW_API_PUBLIC dwStatus dwLogger_getLogLevel ( dwLoggerVerbosity verbosity)

Gets the verbosity level of the logger instance.

Parameters
[out]verbositySpecifies a pointer to the verbosity object to fill.
Return values
DW_INVALID_ARGUMENTif verbosity pointer is invalid.
DW_SUCCESSif operation succeeds.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwLogger_initialize()

DW_API_PUBLIC dwStatus dwLogger_initialize ( dwLogCallback  msgCallback)

Creates a new logger instance.

The initialization behavior of the logger is as follows. If the logger is initialized with dwLogger_initializeExtended, then the dwLoggerCallback provided to that function will be used. If the logger is initialized with dwLogger_initialize, then the dwLogCallback provided to that function will be used. If the logger is initialized with both functions, then the function provided to dwLogger_initializeExtended will take precedence

Parameters
[in]msgCallbackSpecifies the callback method used by the SDK to pass log messages. It must be thread-safe.
Return values
DW_SUCCESSif operation succeeds.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: No

◆ dwLogger_initializeExtended()

DW_API_PUBLIC dwStatus dwLogger_initializeExtended ( dwLoggerCallback  msgCallback)

Creates a new logger instance that provides meta-data with the message.

The initialization behavior of the logger is as follows. If the logger is initialized with dwLogger_initializeExtended, then the dwLoggerCallback provided to that function will be used. If the logger is initialized with dwLogger_initialize then the dwLogCallback provided to that function will be used. If the logger is initialized with both functions, then the function provided to dwLogger_initializeExtended will take precedence

Parameters
[in]msgCallbackSpecifies the callback method used by the SDK to pass log messages. It must be thread-safe.
Return values
DW_SUCCESSif operation succeeds.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: No

◆ dwLogger_log()

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

Logs message.

if an extended callback has been initialized then it will return default values for parameters not provided
tag will be "NO_TAG"
fileName will be ""
lineNum will be 0
threadId will be ""

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.
Return values
DW_INVALID_ARGUMENTif verbosity parameter is not inside the dwLoggerVerbosity enum OR if msg is a null pointer.
DW_SUCCESSif no issues are encountered.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwLogger_logExtended()

DW_API_PUBLIC dwStatus dwLogger_logExtended ( const dwLoggerMessage msg)

Logs message.

Parameters
[in]msgSpecifies message to be logged with additional meta-data
Return values
DW_INVALID_ARGUMENTif msg is a null pointer.
DW_SUCCESSif no issues are encountered.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwLogger_release()

DW_API_PUBLIC dwStatus dwLogger_release ( void  )

Release logger instance and free up used memory.

Returns
DW_SUCCESS always.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: Yes

◆ dwLogger_setLogLevel()

DW_API_PUBLIC dwStatus dwLogger_setLogLevel ( dwLoggerVerbosity const  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.
Return values
DW_INVALID_ARGUMENTif verbosity parameter is invalid, not inside the dwLoggerVerbosity enum.
DW_SUCCESSif operation succeeds.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwLogger_setThreadId()

DW_API_PUBLIC dwStatus dwLogger_setThreadId ( char8_t const *  threadId)

Set the name of the current thread that will be returned when using extended logger.

Thread id should be set prior to calling any other DW function to avoid confusion
If this function is not called the logger uses an incrementing counter by default
Truncates after 64 characters

Parameters
[in]threadIdSpecifies name of the current thread
Return values
DW_SUCCESSalways.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes