2 * This file is part of the sigrok project.
4 * Copyright (C) 2011 Uwe Hermann <uwe@hermann-uwe.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #include <sigrok-internal.h>
26 static int sr_logv(int loglevel, const char *format, va_list args)
30 /* Avoid compiler warnings. */
33 ret = vfprintf(stderr, format, args);
34 fprintf(stderr, "\n");
39 int sr_log(int loglevel, const char *format, ...)
44 va_start(args, format);
45 ret = sr_logv(loglevel, format, args);
51 int sr_dbg(const char *format, ...)
56 va_start(args, format);
57 ret = sr_logv(SR_LOG_DBG, format, args);
63 int sr_info(const char *format, ...)
68 va_start(args, format);
69 ret = sr_logv(SR_LOG_INFO, format, args);
75 int sr_warn(const char *format, ...)
80 va_start(args, format);
81 ret = sr_logv(SR_LOG_WARN, format, args);
87 int sr_err(const char *format, ...)
92 va_start(args, format);
93 ret = sr_logv(SR_LOG_ERR, format, args);