33a9c90e3b3eaacbb459955e804fd2afe34dc4ba
[oweals/opkg-lede.git] / libopkg / opkg_message.c
1 /* opkg_message.c - the opkg package management system
2
3    Copyright (C) 2003 Daniele Nicolodi <daniele@grinta.net>
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 as
7    published by the Free Software Foundation; either version 2, or (at
8    your option) any later version.
9
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14 */
15
16
17 #include "includes.h"
18 #include "opkg_conf.h"
19 #include "opkg_message.h"
20 #include "opkg_error.h"
21 #include "opkg_utils.h"
22
23 void
24 opkg_message (opkg_conf_t * conf, message_level_t level, char *fmt, ...)
25 {
26         va_list ap;
27
28         if (conf && (conf->verbosity < level))
29                 return;
30
31         va_start (ap, fmt);
32
33         if (level == OPKG_ERROR) {
34                 char msg[256];
35                 vsnprintf(msg, 256, fmt, ap);
36                 push_error_list(msg);
37         } else
38                 vprintf(fmt, ap);
39
40         va_end (ap);
41 }