DriveWorks SDK Reference
5.10.90 Release
For Test and Development only

Logger.h
Go to the documentation of this file.
1
2//
3// Notice
4// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
5// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
6// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
7// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8//
9// NVIDIA CORPORATION & AFFILIATES assumes no responsibility for the consequences of use of such
10// information or for any infringement of patents or other rights of third parties that may
11// result from its use. No license is granted by implication or otherwise under any patent
12// or patent rights of NVIDIA CORPORATION & AFFILIATES. No third party distribution is allowed unless
13// expressly authorized by NVIDIA. Details are subject to change without notice.
14// This code supersedes and replaces all information previously supplied.
15// NVIDIA CORPORATION & AFFILIATES products are not authorized for use as critical
16// components in life support devices or systems without express written approval of
17// NVIDIA CORPORATION & AFFILIATES.
18//
19// SPDX-FileCopyrightText: Copyright (c) 2016-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
20// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
21//
22// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
23// property and proprietary rights in and to this material, related
24// documentation and any modifications thereto. Any use, reproduction,
25// disclosure or distribution of this material and related documentation
26// without an express license agreement from NVIDIA CORPORATION or
27// its affiliates is strictly prohibited.
28//
30
50#ifndef DW_CORE_LOGGER_H_
51#define DW_CORE_LOGGER_H_
52
53#include <dw/core/base/Config.h>
55#include <dw/core/base/Types.h>
56#include <dw/core/base/Status.h>
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
62// Forward declaration of dwContextHandle_t to avoid circular dependency.
63// @note: The API using the dwContextHandle_t is deprecated
64// coverity[misra_c_2012_rule_1_1_violation]
65typedef struct dwContextObject* dwContextHandle_t;
66// coverity[misra_c_2012_rule_1_1_violation]
67typedef struct dwContextObject const* dwConstContextHandle_t;
68
72typedef enum dwLoggerVerbosity {
73 DW_LOG_VERBOSE = 0x0000,
74 DW_LOG_DEBUG = 0x1000,
75 DW_LOG_INFO = 0x2000,
76 DW_LOG_WARN = 0x3000,
77 DW_LOG_ERROR = 0x4000,
78 DW_LOG_SILENT = 0x7000
80
81typedef struct dwLoggerMessage
82{
83 char8_t const* msg;
85 char8_t const* tag;
86 char8_t const* fileName;
87 int32_t lineNum;
88 char8_t const* threadId;
90
98typedef void (*dwLogCallback)(dwContextHandle_t context, dwLoggerVerbosity type, char8_t const* msg);
99
105typedef void (*dwLoggerCallback)(dwLoggerMessage const* msg);
106
124
142
153
163
180DW_API_PUBLIC dwStatus dwLogger_log(dwConstContextHandle_t const context, dwLoggerVerbosity const verbosity, char8_t const* const msg);
181
192
199
212
213#ifdef __cplusplus
214}
215#endif
217#endif // DW_CORE_LOGGER_H_
NVIDIA DriveWorks API: Core Status Methods
NVIDIA DriveWorks API: Core Types
NVIDIA DriveWorks API: Core Exports
struct dwContextObject const * dwConstContextHandle_t
Definition: Context.h:84
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:83
#define DW_API_PUBLIC
Definition: Exports.h:54
dwLoggerVerbosity verbosity
how severe is the log
Definition: Logger.h:84
char8_t const * tag
name used to group related logs
Definition: Logger.h:85
char8_t const * fileName
file name from where message was logged
Definition: Logger.h:86
char8_t const * threadId
identifier for thread
Definition: Logger.h:88
int32_t lineNum
line number where log originated from
Definition: Logger.h:87
char8_t const * msg
message to log
Definition: Logger.h:83
void(* dwLogCallback)(dwContextHandle_t context, dwLoggerVerbosity type, char8_t const *msg)
Defines a user callback method called by the SDK to log the output.
Definition: Logger.h:98
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.
struct dwContextObject const * dwConstContextHandle_t
Definition: Logger.h:67
DW_API_PUBLIC dwStatus dwLogger_initialize(dwLogCallback msgCallback)
Creates a new logger instance.
DW_API_PUBLIC dwStatus dwLogger_logExtended(const dwLoggerMessage *msg)
Logs message.
DW_API_PUBLIC dwStatus dwLogger_log(dwConstContextHandle_t const context, dwLoggerVerbosity const verbosity, char8_t const *const msg)
Logs message.
DW_API_PUBLIC dwStatus dwLogger_initializeExtended(dwLoggerCallback msgCallback)
Creates a new logger instance that provides meta-data with the message.
void(* dwLoggerCallback)(dwLoggerMessage const *msg)
Defines a user callback method called by the SDK to log the output with meta-data.
Definition: Logger.h:105
DW_API_PUBLIC dwStatus dwLogger_release(void)
Release logger instance and free up used memory.
dwLoggerVerbosity
Holds the verbosity level.
Definition: Logger.h:72
DW_API_PUBLIC dwStatus dwLogger_setLogLevel(dwLoggerVerbosity const verbosity)
Sets the verbosity level of the logger instance.
DW_API_PUBLIC dwStatus dwLogger_enableTimestamps(bool const enabled)
Enable or disable logging of timestamps before each message.
struct dwContextObject * dwContextHandle_t
Definition: Logger.h:65
@ DW_LOG_WARN
Log Warning information.
Definition: Logger.h:76
@ DW_LOG_INFO
Log Notice information.
Definition: Logger.h:75
@ DW_LOG_DEBUG
Log Debug information.
Definition: Logger.h:74
@ DW_LOG_VERBOSE
Log everything, default log level.
Definition: Logger.h:73
@ DW_LOG_SILENT
Log nothing.
Definition: Logger.h:78
@ DW_LOG_ERROR
Log Error information.
Definition: Logger.h:77
dwStatus
Status definition.
Definition: Status.h:173