NVIDIA DeepStream SDK API Reference

7.0 Release
nvdsinfer_logger.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2023 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 
19 #include <NvInfer.h>
20 #include <nvdsinfer.h>
21 
22 #if defined(NDEBUG)
23 #define INFER_LOG_FORMAT_(fmt) fmt
24 #else
25 #define INFER_LOG_FORMAT_(fmt) "%s:%d " fmt, __FILE__, __LINE__
26 #endif
27 
28 #define dsInferError(fmt, ...) \
29  do { \
30  dsInferLogPrint__( \
31  NVDSINFER_LOG_ERROR, INFER_LOG_FORMAT_(fmt), ##__VA_ARGS__); \
32  } while (0)
33 
34 #define dsInferWarning(fmt, ...) \
35  do { \
36  dsInferLogPrint__( \
37  NVDSINFER_LOG_WARNING, INFER_LOG_FORMAT_(fmt), ##__VA_ARGS__); \
38  } while (0)
39 
40 #define dsInferInfo(fmt, ...) \
41  do { \
42  dsInferLogPrint__( \
43  NVDSINFER_LOG_INFO, INFER_LOG_FORMAT_(fmt), ##__VA_ARGS__); \
44  } while (0)
45 
46 #define dsInferDebug(fmt, ...) \
47  do { \
48  dsInferLogPrint__( \
49  NVDSINFER_LOG_DEBUG, INFER_LOG_FORMAT_(fmt), ##__VA_ARGS__); \
50  } while (0)
51 
52 namespace nvdsinfer {
53 void dsInferLogPrint__(NvDsInferLogLevel level, const char* fmt, ...);
54 }
55 
56 extern std::unique_ptr<nvinfer1::ILogger> gTrtLogger;
57 #endif
gTrtLogger
std::unique_ptr< nvinfer1::ILogger > gTrtLogger
NvDsInferLogLevel
NvDsInferLogLevel
Enum for the log levels of NvDsInferContext.
Definition: nvdsinfer.h:249
nvdsinfer
Definition: nvdsinfer_model_builder.h:42
nvdsinfer.h
nvdsinfer::dsInferLogPrint__
void dsInferLogPrint__(NvDsInferLogLevel level, const char *fmt,...)
Print the nvinferserver log messages as per the configured log level.
Definition: infer_options.h:27