libcfe  0.12.1
some useful C-functions
output.h
Go to the documentation of this file.
1 #ifndef XOUTPUT_H
2 #define XOUTPUT_H
3 
4 #include <stdio.h>
5 #include <syslog.h>
6 
7 #define LOG_EMERG_NAME "PANIC"
8 #define LOG_ALERT_NAME "ALERT"
9 #define LOG_CRIT_NAME "CRIT"
10 #define LOG_ERR_NAME "ERROR"
11 #define LOG_WARNING_NAME "WARN"
12 #define LOG_NOTICE_NAME "NOTICE"
13 #define LOG_INFO_NAME "INFO"
14 #define LOG_DEBUG_NAME "DEBUG"
15 
16 #define LOG_ERROR LOG_ERR
17 
18 #undef error
19 #undef output
20 #undef debug
21 
25 #define output output1
26 
30 #define error(...) output(LOG_ERR, __VA_ARGS__)
31 
32 #ifdef DEBUG
33 
36 # define debug(...) output(LOG_DEBUG, __VA_ARGS__)
37 #else
38 # define debug(...) emptyfunc()
39 #endif
40 
41 #ifndef _
42 # include <libintl.h>
43 # define _(string) gettext(string)
44 #endif
45 
46 #define _OUTPUT_GET_CURRENT_VALUE 127
47 
48 #define _OUTPUT_MODE_PRINT 1
49 #define _OUTPUT_MODE_SYSLOG 2
50 #define _OUTPUT_MODE_FILE 4
51 
52 
55 static inline void emptyfunc(void) { return; }
56 
62 int set_output_level(int lvl);
63 
72 int set_output_mode(int mode);
73 
81 int set_output_file(FILE *out);
82 
89 void output1(int lvl, const char *msg, ...) __attribute__ ((format (printf, 2, 3)));
90 
91 #endif /* XOUTPUT_H */
int set_output_mode(int mode)
Definition: output.c:33
int set_output_file(FILE *out)
Definition: output.c:45
int set_output_level(int lvl)
Definition: output.c:24
void output1(int lvl, const char *msg,...) __attribute__((format(printf