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.
◆ dwConstContextHandle_t
◆ dwContextHandle_t
The Driveworks context handle.
Definition at line 66 of file Logger.h.
◆ dwLogCallback
Defines a user callback method called by the SDK to log the output.
- Parameters
-
[in] | context | Deprecated context pointer, set to DW_NULL_HANDLE. Should not be used |
[in] | type | Specifies the type of message being logged. |
[in] | msg | A pointer to the message. |
Definition at line 86 of file Logger.h.
◆ dwLoggerCallback
Defines a user callback method called by the SDK to log the output with meta-data.
- Parameters
-
[in] | msg | A struct containing message and meta-data |
Definition at line 93 of file Logger.h.
◆ dwLoggerMessage
◆ dwLoggerVerbosity
Holds the verbosity level.
◆ dwLogMessage
a textual log message through, e.g., DW_LOG APIs
◆ dwLogMessageInfo
metatdata associated with a log message
◆ dwSizes
Holds the maximum sizes for various strings.
◆ dwSourceCodeLocation
Where in the source code a particular log message originates.
◆ 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
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.
◆ dwLogger_enableTimestamps()
Enable or disable logging of timestamps before each message.
dwLogger is initialized with timestamps enabled.
- Parameters
-
[in] | enabled | Whether to log timestamps (true) or not (false). |
- Return values
-
- API Group
- Init: Yes
- Runtime: Yes
- De-Init: Yes
◆ dwLogger_getLogLevel()
Gets the verbosity level of the logger instance.
- Parameters
-
[out] | verbosity | Specifies a pointer to the verbosity object to fill. |
- Return values
-
DW_INVALID_ARGUMENT | if verbosity pointer is invalid. |
DW_SUCCESS | if operation succeeds. |
- API Group
- Init: Yes
- Runtime: Yes
- De-Init: Yes
◆ dwLogger_initialize()
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] | msgCallback | Specifies the callback method used by the SDK to pass log messages. It must be thread-safe. |
- Return values
-
DW_SUCCESS | if operation succeeds. |
- API Group
- Init: Yes
- Runtime: No
- De-Init: No
◆ dwLogger_initializeExtended()
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] | msgCallback | Specifies the callback method used by the SDK to pass log messages. It must be thread-safe. |
- Return values
-
DW_SUCCESS | if operation succeeds. |
- API Group
- Init: Yes
- Runtime: No
- De-Init: No
◆ dwLogger_log()
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] | context | Specifies the DriveWorks context that generated this message. |
[in] | verbosity | Specifies the verbosity level to use. |
[in] | msg | Specifies message which is to be logged. |
- Return values
-
DW_INVALID_ARGUMENT | if verbosity parameter is not inside the dwLoggerVerbosity enum OR if msg is a null pointer.
|
DW_SUCCESS | if no issues are encountered. |
- API Group
- Init: Yes
- Runtime: Yes
- De-Init: Yes
◆ dwLogger_logExtended()
Logs message.
- Parameters
-
[in] | msg | Specifies message to be logged with additional meta-data |
- Return values
-
DW_INVALID_ARGUMENT | if msg is a null pointer. |
DW_SUCCESS | if no issues are encountered. |
- API Group
- Init: Yes
- Runtime: Yes
- De-Init: Yes
◆ dwLogger_release()
Release logger instance and free up used memory.
- Returns
- DW_SUCCESS always.
- API Group
- Init: Yes
- Runtime: No
- De-Init: Yes
◆ dwLogger_setLogLevel()
Sets the verbosity level of the logger instance.
Any messages with higher or equal verbosity level is forwarded to the logger callback.
- Parameters
-
[in] | verbosity | Specifies the verbosity level to use. |
- Return values
-
DW_INVALID_ARGUMENT | if verbosity parameter is invalid, not inside the dwLoggerVerbosity enum. |
DW_SUCCESS | if operation succeeds. |
- API Group
- Init: Yes
- Runtime: Yes
- De-Init: Yes
◆ dwLogger_setThreadId()
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] | threadId | Specifies name of the current thread |
- Return values
-
- API Group
- Init: Yes
- Runtime: Yes
- De-Init: Yes