Jetson Linux Multimedia API Reference
32.4.3 Release
Welcome
Important Terms
API Modules
Sample Applications
Tools
Data Structures
Files
More
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
NvLogging.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3
*
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
6
* are met:
7
* * Redistributions of source code must retain the above copyright
8
* notice, this list of conditions and the following disclaimer.
9
* * Redistributions in binary form must reproduce the above copyright
10
* notice, this list of conditions and the following disclaimer in the
11
* documentation and/or other materials provided with the distribution.
12
* * Neither the name of NVIDIA CORPORATION nor the names of its
13
* contributors may be used to endorse or promote products derived
14
* from this software without specific prior written permission.
15
*
16
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
17
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
*/
28
36
#ifndef __NV_LOGGING_H_
37
#define __NV_LOGGING_H_
38
39
#include <iostream>
40
#include <sstream>
41
57
#define LOG_LEVEL_INFO 0
58
61
#define LOG_LEVEL_ERROR 1
62
65
#define LOG_LEVEL_WARN 2
66
69
#define LOG_LEVEL_DEBUG 3
70
75
extern
int
log_level
;
76
80
#define DEFAULT_LOG_LEVEL LOG_LEVEL_ERROR
81
85
#define stringify(s) #s
86
#define xstringify(s) stringify(s)
87
#define __LINE_NUM_STR__ xstringify(__LINE__)
88
89
extern
const
char
*log_level_name[];
107
#define PRINT_MSG(level, str1) if(level <= log_level) { \
108
std::ostringstream ostr; \
109
ostr << "[" << log_level_name[level] << "] (" << \
110
__FILE__ << ":" __LINE_NUM_STR__ ") " << \
111
str1 << std::endl; \
112
std::cerr << ostr.str(); \
113
}
114
118
#define INFO_MSG(str) PRINT_MSG(LOG_LEVEL_INFO, str)
119
127
#define COMP_INFO_MSG(str) INFO_MSG("<" << comp_name << "> " << str)
128
136
#define CAT_INFO_MSG(str) INFO_MSG("<" CAT_NAME "> " << str)
137
141
#define ERROR_MSG(str) PRINT_MSG(LOG_LEVEL_ERROR, str)
142
150
#define COMP_ERROR_MSG(str) ERROR_MSG("<" << comp_name << "> " << str)
151
159
#define CAT_ERROR_MSG(str) ERROR_MSG("<" CAT_NAME "> " << str)
160
165
#define SYS_ERROR_MSG(str) ERROR_MSG(str << ": " << strerror(errno))
166
174
#define COMP_SYS_ERROR_MSG(str) SYS_ERROR_MSG("<" << comp_name << "> " << str)
175
183
#define CAT_SYS_ERROR_MSG(str) SYS_ERROR_MSG("<" CAT_NAME "> " << str)
184
188
#define WARN_MSG(str) PRINT_MSG(LOG_LEVEL_WARN, str)
189
197
#define COMP_WARN_MSG(str) WARN_MSG("<" << comp_name << "> :" << str)
198
207
#define CAT_WARN_MSG(str) WARN_MSG("<" CAT_NAME "> " << str)
208
212
#define DEBUG_MSG(str) PRINT_MSG(LOG_LEVEL_DEBUG, str)
213
221
#define COMP_DEBUG_MSG(str) DEBUG_MSG("<" << comp_name << "> :" << str)
222
230
#define CAT_DEBUG_MSG(str) DEBUG_MSG("<" CAT_NAME "> " << str)
231
232
#endif
233
log_level
int log_level
Holds the current log level at runtime by assignment of one of the LOG_LEVEL_* values.
Advance Information | Subject to Change | Generated by NVIDIA | Thu Jul 2 2020 14:15:47 | PR-08664-R32