125
|
1 /*
|
|
2 * trace.h : GeeXboX uShare log facility headers.
|
|
3 * Originally developped for the GeeXboX project.
|
|
4 * Copyright (C) 2005-2007 Alexis Saettler <asbin@asbin.org>
|
|
5 *
|
|
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.
|
|
10 *
|
|
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 Library General Public License for more details.
|
|
15 *
|
|
16 * You should have received a copy of the GNU General Public License along
|
|
17 * with this program; if not, write to the Free Software Foundation,
|
|
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
19 */
|
|
20
|
|
21 #ifndef _TRACE_H_
|
|
22 #define _TRACE_H_
|
|
23
|
|
24 typedef enum {
|
|
25 ULOG_NORMAL = 1,
|
|
26 ULOG_ERROR = 2,
|
|
27 ULOG_VERBOSE = 3,
|
|
28 } log_level;
|
|
29
|
|
30 void print_log (log_level level, const char *format, ...)
|
|
31 __attribute__ ((format (printf, 2, 3)));
|
|
32 inline void start_log (void);
|
|
33
|
|
34 /* log_info
|
|
35 * Normal print, to replace printf
|
|
36 */
|
|
37 #define log_info(s, str...) { \
|
|
38 print_log (ULOG_NORMAL, (s), ##str); \
|
|
39 }
|
|
40
|
|
41 /* log_error
|
|
42 * Error messages, output to stderr
|
|
43 */
|
|
44 #define log_error(s, str...) { \
|
|
45 print_log (ULOG_ERROR, (s), ##str); \
|
|
46 }
|
|
47
|
|
48 /* log_verbose
|
|
49 * Output only in verbose mode
|
|
50 */
|
|
51 #define log_verbose(s, str...) { \
|
|
52 print_log (ULOG_VERBOSE, (s), ##str); \
|
|
53 }
|
|
54
|
|
55 #endif /* _TRACE_H_ */
|