Debian Codegraph @

src/logger.c

raw
1 /*
2 * This file is part of libdvdnav, a DVD navigation library.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
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 Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
17 */
18
19 #include "config.h"
20 #include <stdio.h>
21 #include <stdarg.h>
22
23 #include "dvdnav/dvdnav.h"
24 #include "logger.h"
25
26 void dvdnav_log( void *priv, const dvdnav_logger_cb *logcb,
27 dvdnav_logger_level_t level, const char *fmt, ... )
28 {
29 va_list list;
30 va_start(list, fmt);
31 if(logcb && logcb->pf_log)
32 logcb->pf_log(priv, level, fmt, list);
33 else
34 {
35 FILE *stream = (level == DVDNAV_LOGGER_LEVEL_ERROR) ? stderr : stdout;
36 fprintf(stream, "libdvdnav: ");
37 vfprintf(stream, fmt, list);
38 fprintf(stream, "\n");
39 }
40 va_end(list);
41 }