USRP Hardware Driver and USRP Manual  Version: 4.7.0.0
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 #pragma once
8 
9 #include <uhd/config.h>
10 
11 typedef enum {
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 void UHD_API _uhd_log(const uhd_log_severity_level_t log_level,
25  const char* filename,
26  const int lineno,
27  const char* comp,
28  const char* format,
29  ...);
30 
31 #ifdef __cplusplus
32 };
33 #endif
34 
35 
36 #ifndef __cplusplus
37 // macro-style logging (compile-time determined)
38 # if UHD_LOG_MIN_LEVEL < 1
39 # define UHD_LOG_TRACE(component, ...) \
40  _uhd_log(UHD_LOG_LEVEL_TRACE, __FILE__, __LINE__, component, __VA_ARGS__);
41 # else
42 # define UHD_LOG_TRACE(component, ...)
43 # endif
44 
45 # if UHD_LOG_MIN_LEVEL < 2
46 # define UHD_LOG_DEBUG(component, ...) \
47  _uhd_log(UHD_LOG_LEVEL_DEBUG, __FILE__, __LINE__, component, __VA_ARGS__);
48 # else
49 # define UHD_LOG_DEBUG(component, ...)
50 # endif
51 
52 # if UHD_LOG_MIN_LEVEL < 3
53 # define UHD_LOG_INFO(component, ...) \
54  _uhd_log(UHD_LOG_LEVEL_INFO, __FILE__, __LINE__, component, __VA_ARGS__);
55 # else
56 # define UHD_LOG_INFO(component, ...)
57 # endif
58 
59 # if UHD_LOG_MIN_LEVEL < 4
60 # define UHD_LOG_WARNING(component, ...) \
61  _uhd_log(UHD_LOG_LEVEL_WARNING, __FILE__, __LINE__, component, __VA_ARGS__);
62 # else
63 # define UHD_LOG_WARNING(component, ...)
64 # endif
65 
66 # if UHD_LOG_MIN_LEVEL < 5
67 # define UHD_LOG_ERROR(component, ...) \
68  _uhd_log(UHD_LOG_LEVEL_ERROR, __FILE__, __LINE__, component, __VA_ARGS__);
69 # else
70 # define UHD_LOG_ERROR(component, ...)
71 # endif
72 
73 # if UHD_LOG_MIN_LEVEL < 6
74 # define UHD_LOG_FATAL(component, ...) \
75  _uhd_log(UHD_LOG_LEVEL_FATAL, __FILE__, __LINE__, component, __VA_ARGS__);
76 # else
77 # define UHD_LOG_FATAL(component, ...)
78 # endif
79 
80 #endif /* #ifndef __cplusplus */
Definition: log.h:12
uhd_log_severity_level_t
Definition: log.h:11
Definition: log.h:16
Definition: log.h:15
Definition: log.h:14
#define UHD_API
Definition: config.h:87
Definition: log.h:17
Definition: log.h:13
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,...)