libdvbv5  1.11.0
Library to work with Digital TV devices on Linux
dvb-log.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2014 - Mauro Carvalho Chehab
3  * Copyright (c) 2012 - Andre Roth <neolynx@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation version 2.1 of the License.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18  *
19  */
20 
21 #ifndef _LOG_H
22 #define _LOG_H
23 
24 #include <syslog.h>
25 
44 typedef void (*dvb_logfunc)(int level, const char *fmt, ...) __attribute__ (( format( printf, 2, 3 )));
45 
46 /*
47  * Macros used internally inside libdvbv5 frontend part, to output logs
48  */
49 
50 #ifndef _DOXYGEN
51 
52 #ifndef __DVB_FE_PRIV_H
53 
54 #define dvb_log(fmt, arg...) do {\
55  parms->logfunc(LOG_INFO, fmt, ##arg); \
56 } while (0)
57 #define dvb_logerr(fmt, arg...) do {\
58  parms->logfunc(LOG_ERR, fmt, ##arg); \
59 } while (0)
60 #define dvb_logdbg(fmt, arg...) do {\
61  parms->logfunc(LOG_DEBUG, fmt, ##arg); \
62 } while (0)
63 #define dvb_logwarn(fmt, arg...) do {\
64  parms->logfunc(LOG_WARNING, fmt, ##arg); \
65 } while (0)
66 #define dvb_loginfo(fmt, arg...) do {\
67  parms->logfunc(LOG_NOTICE, fmt, ##arg); \
68 } while (0)
69 
70 #define dvb_perror(msg) do {\
71  parms->logfunc(LOG_ERR, "%s: %s", msg, strerror(errno)); \
72 } while (0)
73 
74 #else
75 
76 #define dvb_log(fmt, arg...) do {\
77  parms->p.logfunc(LOG_INFO, fmt, ##arg); \
78 } while (0)
79 #define dvb_logerr(fmt, arg...) do {\
80  parms->p.logfunc(LOG_ERR, fmt, ##arg); \
81 } while (0)
82 #define dvb_logdbg(fmt, arg...) do {\
83  parms->p.logfunc(LOG_DEBUG, fmt, ##arg); \
84 } while (0)
85 #define dvb_logwarn(fmt, arg...) do {\
86  parms->p.logfunc(LOG_WARNING, fmt, ##arg); \
87 } while (0)
88 #define dvb_loginfo(fmt, arg...) do {\
89  parms->p.logfunc(LOG_NOTICE, fmt, ##arg); \
90 } while (0)
91 
92 #define dvb_perror(msg) do {\
93  parms->p.logfunc(LOG_ERR, "%s: %s", msg, strerror(errno)); \
94 } while (0)
95 
96 #endif
97 
98 #endif /* _DOXYGEN */
99 
108 void dvb_default_log(int level, const char *fmt, ...) __attribute__ (( format( printf, 2, 3 )));
109 
110 #endif
void dvb_default_log(int level, const char *fmt,...)
This is the prototype of the internal log function that it is used, if the library client doesn't des...
void(* dvb_logfunc)(int level, const char *fmt,...)
typedef used by dvb_fe_open2 for the log function
Definition: dvb-log.h:44