str_list_prev: remove unused function
[oweals/opkg-lede.git] / libopkg / opkg_message.h
1 /* opkg_message.h - the opkg package management system
2
3    Copyright (C) 2009 Ubiq Technologies <graham.gower@gmail.com>
4    Copyright (C) 2003 Daniele Nicolodi <daniele@grinta.net>
5
6    This program is free software; you can redistribute it and/or
7    modify it under the terms of the GNU General Public License as
8    published by the Free Software Foundation; either version 2, or (at
9    your option) any later version.
10
11    This program is distributed in the hope that it will be useful, but
12    WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    General Public License for more details.
15 */
16
17 #ifndef _OPKG_MESSAGE_H_
18 #define _OPKG_MESSAGE_H_
19
20 #include <string.h>
21 #include <errno.h>
22
23 typedef enum {
24         ERROR,                  /* error conditions */
25         NOTICE,                 /* normal but significant condition */
26         INFO,                   /* informational message */
27         DEBUG,                  /* debug level message */
28         DEBUG2,                 /* more debug level message */
29 } message_level_t;
30
31 void free_error_list(void);
32 void print_error_list(void);
33 void opkg_message(message_level_t level, const char *fmt, ...)
34     __attribute__ ((format(printf, 2, 3)));
35
36 #define opkg_msg(l, fmt, args...) \
37         do { \
38                 if (l == NOTICE) \
39                         opkg_message(l, fmt, ##args); \
40                 else \
41                         opkg_message(l, "%s: "fmt, __FUNCTION__, ##args); \
42         } while (0)
43
44 #define opkg_perror(l, fmt, args...) \
45         opkg_msg(l, fmt": %s.\n", ##args, strerror(errno))
46
47 #endif /* _OPKG_MESSAGE_H_ */