DriveWorks SDK Reference
5.14.77 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-2023 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#include "LoggerDefs.h"
59
60#ifdef __cplusplus
61extern "C" {
62#endif
63
64// Forward declaration of dwContextHandle_t to avoid circular dependency.
65// @note: The API using the dwContextHandle_t is deprecated
66// coverity[misra_c_2012_rule_1_1_violation]
67typedef struct dwContextObject* dwContextHandle_t;
68// coverity[misra_c_2012_rule_1_1_violation]
69typedef struct dwContextObject const* dwConstContextHandle_t;
70
71typedef struct dwLoggerMessage
72{
73 char8_t const* msg;
75 char8_t const* tag;
76 char8_t const* fileName;
77 int32_t lineNum;
78 char8_t const* threadId;
80
88typedef void (*dwLogCallback)(dwContextHandle_t context, dwLoggerVerbosity type, char8_t const* msg);
89
95typedef void (*dwLoggerCallback)(dwLoggerMessage const* msg);
96
114
132
143
153
170DW_API_PUBLIC dwStatus dwLogger_log(dwConstContextHandle_t const context, dwLoggerVerbosity const verbosity, char8_t const* const msg);
171
182
189
202
203#ifdef __cplusplus
204}
205#endif
207#endif // DW_CORE_LOGGER_H_
dwStatus
Status definition.
Definition: ErrorDefs.h:45
NVIDIA DriveWorks API: Core Warp Primitives
NVIDIA DriveWorks API: Core Status Methods
NVIDIA DriveWorks API: Core Types
NVIDIA DriveWorks API: Core Exports
struct dwContextObject const * dwConstContextHandle_t
Definition: Context.h:87
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:86
#define DW_API_PUBLIC
Definition: Exports.h:54
dwLoggerVerbosity verbosity
how severe is the log
Definition: Logger.h:74
char8_t const * tag
name used to group related logs
Definition: Logger.h:75
char8_t const * fileName
file name from where message was logged
Definition: Logger.h:76
char8_t const * threadId
identifier for thread
Definition: Logger.h:78
int32_t lineNum
line number where log originated from
Definition: Logger.h:77
char8_t const * msg
message to log
Definition: Logger.h:73
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:88
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:69
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:95
DW_API_PUBLIC dwStatus dwLogger_release(void)
Release logger instance and free up used memory.
dwLoggerVerbosity
Holds the verbosity level.
Definition: LoggerDefs.h:63
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:67