]> git.ozlabs.org Git - petitboot/blob - lib/log/log.h
discover: Add --debug to kexec
[petitboot] / lib / log / log.h
1 #ifndef _LOG_H
2 #define _LOG_H
3
4 #include <stdbool.h>
5 #include <stdio.h>
6
7 void __attribute__ ((format (printf, 1, 2))) pb_log(const char *fmt, ...);
8 void __attribute__ ((format (printf, 2, 3))) _pb_log_fn(const char *func,
9         const char *fmt, ...);
10 #define pb_log_fn(args...) _pb_log_fn(__func__, args)
11
12 void __attribute__ ((format (printf, 1, 2))) pb_debug(const char *fmt, ...);
13 void __attribute__ ((format (printf, 2, 3))) _pb_debug_fn(const char *func,
14         const char *fmt, ...);
15 #define pb_debug_fn(args...) _pb_debug_fn(__func__, args)
16 void __attribute__ ((format (printf, 3, 4))) _pb_debug_fl(const char *func,
17         int line, const char *fmt, ...);
18 #define pb_debug_fl(args...) _pb_debug_fl(__func__, __LINE__, args)
19
20 void __pb_log_init(FILE *stream, bool debug);
21
22 #ifdef DEBUG
23 #define pb_log_init(s) __pb_log_init(s, true)
24 #else
25 #define pb_log_init(s) __pb_log_init(s, false)
26 #endif
27
28 void pb_log_set_debug(bool debug);
29 bool pb_log_get_debug(void);
30 FILE *pb_log_get_stream(void);
31
32 #endif /* _LOG_H */