Jetson Linux API Reference
39.2 Release
NvLogging.h
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: Copyright (c) 2016-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
* SPDX-License-Identifier: BSD-3-Clause
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are met:
7
*
8
* 1. Redistributions of source code must retain the above copyright notice, this
9
* list of conditions and the following disclaimer.
10
*
11
* 2. Redistributions in binary form must reproduce the above copyright notice,
12
* this list of conditions and the following disclaimer in the documentation
13
* and/or other materials provided with the distribution.
14
*
15
* 3. Neither the name of the copyright holder nor the names of its
16
* contributors may be used to endorse or promote products derived from
17
* this software without specific prior written permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
*/
30
38
#ifndef __NV_LOGGING_H_
39
#define __NV_LOGGING_H_
40
41
#include <iostream>
42
#include <sstream>
43
59
#define LOG_LEVEL_INFO 0
60
63
#define LOG_LEVEL_ERROR 1
64
67
#define LOG_LEVEL_WARN 2
68
71
#define LOG_LEVEL_DEBUG 3
72
77
extern
int
log_level
;
78
82
#define DEFAULT_LOG_LEVEL LOG_LEVEL_ERROR
83
87
#define NV_STRINGIFY(s) #s
88
#define NV_XSTRINGIFY(s) NV_STRINGIFY(s)
89
#define __LINE_NUM_STR__ NV_XSTRINGIFY(__LINE__)
90
91
extern
const
char
*log_level_name[];
109
#define PRINT_MSG(level, str1) if(level <= log_level) { \
110
std::ostringstream ostr; \
111
ostr << "[" << log_level_name[level] << "] (" << \
112
__FILE__ << ":" __LINE_NUM_STR__ ") " << \
113
str1 << std::endl; \
114
std::cerr << ostr.str(); \
115
}
116
120
#define INFO_MSG(str) PRINT_MSG(LOG_LEVEL_INFO, str)
121
129
#define COMP_INFO_MSG(str) INFO_MSG("<" << comp_name << "> " << str)
130
138
#define CAT_INFO_MSG(str) INFO_MSG("<" CAT_NAME "> " << str)
139
143
#define ERROR_MSG(str) PRINT_MSG(LOG_LEVEL_ERROR, str)
144
152
#define COMP_ERROR_MSG(str) ERROR_MSG("<" << comp_name << "> " << str)
153
161
#define CAT_ERROR_MSG(str) ERROR_MSG("<" CAT_NAME "> " << str)
162
167
#define SYS_ERROR_MSG(str) ERROR_MSG(str << ": " << strerror(errno))
168
176
#define COMP_SYS_ERROR_MSG(str) SYS_ERROR_MSG("<" << comp_name << "> " << str)
177
185
#define CAT_SYS_ERROR_MSG(str) SYS_ERROR_MSG("<" CAT_NAME "> " << str)
186
190
#define WARN_MSG(str) PRINT_MSG(LOG_LEVEL_WARN, str)
191
199
#define COMP_WARN_MSG(str) WARN_MSG("<" << comp_name << "> :" << str)
200
209
#define CAT_WARN_MSG(str) WARN_MSG("<" CAT_NAME "> " << str)
210
214
#define DEBUG_MSG(str) PRINT_MSG(LOG_LEVEL_DEBUG, str)
215
223
#define COMP_DEBUG_MSG(str) DEBUG_MSG("<" << comp_name << "> :" << str)
224
232
#define CAT_DEBUG_MSG(str) DEBUG_MSG("<" CAT_NAME "> " << str)
233
234
#endif
235
log_level
int log_level
Holds the current log level at runtime by assignment of one of the LOG_LEVEL_* values.
Privacy Policy
|
Manage My Privacy
|
Do Not Sell or Share My Data
|
Terms of Service
|
Accessibility
|
Corporate Policies
|
Product Security
|
Contact
© 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Advance Information | Subject to Change | Generated by NVIDIA
Tue Oct 13 2026 16:52:36 | PR-08664-R39