libdvbv5  1.10.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
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation version 2
8  * of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  *
20  */
21 
22 #ifndef _LOG_H
23 #define _LOG_H
24 
25 #include <syslog.h>
26 
45 typedef void (*dvb_logfunc)(int level, const char *fmt, ...) __attribute__ (( format( printf, 2, 3 )));
46 
47 /*
48  * Macros used internally inside libdvbv5 frontend part, to output logs
49  */
50 
51 #ifndef _DOXYGEN
52 
53 #ifndef __DVB_FE_PRIV_H
54 
55 #define dvb_log(fmt, arg...) do {\
56  parms->logfunc(LOG_INFO, fmt, ##arg); \
57 } while (0)
58 #define dvb_logerr(fmt, arg...) do {\
59  parms->logfunc(LOG_ERR, fmt, ##arg); \
60 } while (0)
61 #define dvb_logdbg(fmt, arg...) do {\
62  parms->logfunc(LOG_DEBUG, fmt, ##arg); \
63 } while (0)
64 #define dvb_logwarn(fmt, arg...) do {\
65  parms->logfunc(LOG_WARNING, fmt, ##arg); \
66 } while (0)
67 #define dvb_loginfo(fmt, arg...) do {\
68  parms->logfunc(LOG_NOTICE, fmt, ##arg); \
69 } while (0)
70 
71 #define dvb_perror(msg) do {\
72  parms->logfunc(LOG_ERR, "%s: %s", msg, strerror(errno)); \
73 } while (0)
74 
75 #else
76 
77 #define dvb_log(fmt, arg...) do {\
78  parms->p.logfunc(LOG_INFO, fmt, ##arg); \
79 } while (0)
80 #define dvb_logerr(fmt, arg...) do {\
81  parms->p.logfunc(LOG_ERR, fmt, ##arg); \
82 } while (0)
83 #define dvb_logdbg(fmt, arg...) do {\
84  parms->p.logfunc(LOG_DEBUG, fmt, ##arg); \
85 } while (0)
86 #define dvb_logwarn(fmt, arg...) do {\
87  parms->p.logfunc(LOG_WARNING, fmt, ##arg); \
88 } while (0)
89 #define dvb_loginfo(fmt, arg...) do {\
90  parms->p.logfunc(LOG_NOTICE, fmt, ##arg); \
91 } while (0)
92 
93 #define dvb_perror(msg) do {\
94  parms->p.logfunc(LOG_ERR, "%s: %s", msg, strerror(errno)); \
95 } while (0)
96 
97 #endif
98 
99 #endif /* _DOXYGEN */
100 
109 void dvb_default_log(int level, const char *fmt, ...) __attribute__ (( format( printf, 2, 3 )));
110 
111 #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:45