NVIDIA DeepStream SDK API Reference

8.0 Release
nvdsinfer_logger.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
13 #ifndef __NVDSINFER_LOGGER_H__
14 #define __NVDSINFER_LOGGER_H__
15 
16 #include <memory>
17 #include <mutex>
18 #include <string>
19 #include <array>
20 
21 #include <NvInfer.h>
22 #include <nvdsinfer.h>
23 
24 #if defined(NDEBUG)
25 #define INFER_LOG_FORMAT_(fmt) fmt
26 #else
27 #define INFER_LOG_FORMAT_(fmt) "%s:%d " fmt, __FILE__, __LINE__
28 #endif
29 
30 #define dsInferError(fmt, ...) \
31  do { \
32  dsInferLogPrint__( \
33  NVDSINFER_LOG_ERROR, INFER_LOG_FORMAT_(fmt), ##__VA_ARGS__); \
34  } while (0)
35 
36 #define dsInferWarning(fmt, ...) \
37  do { \
38  dsInferLogPrint__( \
39  NVDSINFER_LOG_WARNING, INFER_LOG_FORMAT_(fmt), ##__VA_ARGS__); \
40  } while (0)
41 
42 #define dsInferInfo(fmt, ...) \
43  do { \
44  dsInferLogPrint__( \
45  NVDSINFER_LOG_INFO, INFER_LOG_FORMAT_(fmt), ##__VA_ARGS__); \
46  } while (0)
47 
48 #define dsInferDebug(fmt, ...) \
49  do { \
50  dsInferLogPrint__( \
51  NVDSINFER_LOG_DEBUG, INFER_LOG_FORMAT_(fmt), ##__VA_ARGS__); \
52  } while (0)
53 
54 namespace nvdsinfer {
55 void dsInferLogPrint__(NvDsInferLogLevel level, const char* fmt, ...);
56 }
57 
58 extern std::unique_ptr<nvinfer1::ILogger> gTrtLogger;
59 #endif
gTrtLogger
std::unique_ptr< nvinfer1::ILogger > gTrtLogger
NvDsInferLogLevel
NvDsInferLogLevel
Enum for the log levels of NvDsInferContext.
Definition: nvdsinfer.h:253
nvdsinfer
Definition: nvdsinfer_logger.h:54
nvdsinfer.h
nvdsinfer::dsInferLogPrint__
void dsInferLogPrint__(NvDsInferLogLevel level, const char *fmt,...)
Definition: infer_options.h:27