USRP Hardware Driver and USRP Manual
Version: 3.11.0.HEAD-0-g13c32cef
UHD and USRP Manual
log.h
Go to the documentation of this file.
1
/*
2
* Copyright 2017 Ettus Research (National Instruments Corp.)
3
*
4
* SPDX-License-Identifier: GPL-3.0-or-later
5
*/
6
7
#ifndef INCLUDED_UHD_UTILS_LOG_H
8
#define INCLUDED_UHD_UTILS_LOG_H
9
10
#include <
uhd/config.h
>
11
12
typedef
enum
{
13
UHD_LOG_LEVEL_TRACE
,
14
UHD_LOG_LEVEL_DEBUG
,
15
UHD_LOG_LEVEL_INFO
,
16
UHD_LOG_LEVEL_WARNING
,
17
UHD_LOG_LEVEL_ERROR
,
18
UHD_LOG_LEVEL_FATAL
19
}
uhd_log_severity_level_t
;
20
21
#ifdef __cplusplus
22
extern
"C"
{
23
#endif
24
25
void
UHD_API
_uhd_log
(
26
const
uhd_log_severity_level_t
log_level,
27
const
char
*filename,
28
const
int
lineno,
29
const
char
*comp,
30
const
char
*format,
31
...
32
);
33
34
#ifdef __cplusplus
35
};
36
#endif
37
38
39
#ifndef __cplusplus
40
// macro-style logging (compile-time determined)
41
#if UHD_LOG_MIN_LEVEL < 1
42
#define UHD_LOG_TRACE(component, ...) \
43
_uhd_log(UHD_LOG_LEVEL_TRACE, __FILE__, __LINE__, component, __VA_ARGS__);
44
#else
45
#define UHD_LOG_TRACE(component, ...)
46
#endif
47
48
#if UHD_LOG_MIN_LEVEL < 2
49
#define UHD_LOG_DEBUG(component, ...) \
50
_uhd_log(UHD_LOG_LEVEL_DEBUG, __FILE__, __LINE__, component, __VA_ARGS__);
51
#else
52
#define UHD_LOG_DEBUG(component, ...)
53
#endif
54
55
#if UHD_LOG_MIN_LEVEL < 3
56
#define UHD_LOG_INFO(component, ...) \
57
_uhd_log(UHD_LOG_LEVEL_INFO, __FILE__, __LINE__, component, __VA_ARGS__);
58
#else
59
#define UHD_LOG_INFO(component, ...)
60
#endif
61
62
#if UHD_LOG_MIN_LEVEL < 4
63
#define UHD_LOG_WARNING(component, ...) \
64
_uhd_log(UHD_LOG_LEVEL_WARNING, __FILE__, __LINE__, component, __VA_ARGS__);
65
#else
66
#define UHD_LOG_WARNING(component, ...)
67
#endif
68
69
#if UHD_LOG_MIN_LEVEL < 5
70
#define UHD_LOG_ERROR(component, ...) \
71
_uhd_log(UHD_LOG_LEVEL_ERROR, __FILE__, __LINE__, component, __VA_ARGS__);
72
#else
73
#define UHD_LOG_ERROR(component, ...)
74
#endif
75
76
#if UHD_LOG_MIN_LEVEL < 6
77
#define UHD_LOG_FATAL(component, ...) \
78
_uhd_log(UHD_LOG_LEVEL_FATAL, __FILE__, __LINE__, component, __VA_ARGS__);
79
#else
80
#define UHD_LOG_FATAL(component, ...)
81
#endif
82
83
#endif
/* #ifndef __cplusplus */
84
85
#endif
/* INCLUDED_UHD_UTILS_LOG_H */
config.h
UHD_LOG_LEVEL_TRACE
Definition:
log.h:13
uhd_log_severity_level_t
uhd_log_severity_level_t
Definition:
log.h:12
UHD_LOG_LEVEL_ERROR
Definition:
log.h:17
UHD_LOG_LEVEL_WARNING
Definition:
log.h:16
UHD_LOG_LEVEL_INFO
Definition:
log.h:15
UHD_API
#define UHD_API
Definition:
config.h:63
UHD_LOG_LEVEL_FATAL
Definition:
log.h:18
UHD_LOG_LEVEL_DEBUG
Definition:
log.h:14
_uhd_log
void UHD_API _uhd_log(const uhd_log_severity_level_t log_level, const char *filename, const int lineno, const char *comp, const char *format,...)
include
uhd
utils
log.h
Generated by
1.8.13