NVIDIA DeepStream SDK API Reference

9.1 Release
sources/includes/nvdsinfer_logger.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef __NVDSINFER_LOGGER_H__
19 #define __NVDSINFER_LOGGER_H__
20 
21 #include <memory>
22 #include <mutex>
23 #include <string>
24 #include <array>
25 
26 #include <NvInfer.h>
27 #include <nvdsinfer.h>
28 
29 #if defined(NDEBUG)
30 #define INFER_LOG_FORMAT_(fmt) fmt
31 #else
32 #define INFER_LOG_FORMAT_(fmt) "%s:%d " fmt, __FILE__, __LINE__
33 #endif
34 
35 #define dsInferError(fmt, ...) \
36  do { \
37  dsInferLogPrint__( \
38  NVDSINFER_LOG_ERROR, INFER_LOG_FORMAT_(fmt), ##__VA_ARGS__); \
39  } while (0)
40 
41 #define dsInferWarning(fmt, ...) \
42  do { \
43  dsInferLogPrint__( \
44  NVDSINFER_LOG_WARNING, INFER_LOG_FORMAT_(fmt), ##__VA_ARGS__); \
45  } while (0)
46 
47 #define dsInferInfo(fmt, ...) \
48  do { \
49  dsInferLogPrint__( \
50  NVDSINFER_LOG_INFO, INFER_LOG_FORMAT_(fmt), ##__VA_ARGS__); \
51  } while (0)
52 
53 #define dsInferDebug(fmt, ...) \
54  do { \
55  dsInferLogPrint__( \
56  NVDSINFER_LOG_DEBUG, INFER_LOG_FORMAT_(fmt), ##__VA_ARGS__); \
57  } while (0)
58 
59 namespace nvdsinfer {
60 void dsInferLogPrint__(NvDsInferLogLevel level, const char* fmt, ...);
61 }
62 
63 extern std::unique_ptr<nvinfer1::ILogger> gTrtLogger;
64 #endif
gTrtLogger
std::unique_ptr< nvinfer1::ILogger > gTrtLogger
NvDsInferLogLevel
NvDsInferLogLevel
Enum for the log levels of NvDsInferContext.
Definition: sources/includes/nvdsinfer.h:262
nvdsinfer
Definition: sources/includes/nvdsinfer_logger.h:59
nvdsinfer.h
nvdsinfer::dsInferLogPrint__
void dsInferLogPrint__(NvDsInferLogLevel level, const char *fmt,...)
Definition: sources/includes/nvdsinferserver/infer_options.h:32