X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=lib%2Flog%2Flog.h;h=c2ad58eef6fc372f3ff586ac43ffb4447cd1dea2;hp=813a19e293773fd9f72ad5c8092a7498d9b65a54;hb=51fb307dfdbb8f238d15520a74e33ef4fea52e4d;hpb=73df817d55376240d17ced8c2b6d89c4f17c4a63 diff --git a/lib/log/log.h b/lib/log/log.h index 813a19e..c2ad58e 100644 --- a/lib/log/log.h +++ b/lib/log/log.h @@ -1,10 +1,32 @@ #ifndef _LOG_H #define _LOG_H +#include #include -void pb_log(const char *fmt, ...); -void pb_log_set_stream(FILE *stream); -void pb_log_always_flush(int state); +void __attribute__ ((format (printf, 1, 2))) pb_log(const char *fmt, ...); +void __attribute__ ((format (printf, 2, 3))) _pb_log_fn(const char *func, + const char *fmt, ...); +#define pb_log_fn(args...) _pb_log_fn(__func__, args) + +void __attribute__ ((format (printf, 1, 2))) pb_debug(const char *fmt, ...); +void __attribute__ ((format (printf, 2, 3))) _pb_debug_fn(const char *func, + const char *fmt, ...); +#define pb_debug_fn(args...) _pb_debug_fn(__func__, args) +void __attribute__ ((format (printf, 3, 4))) _pb_debug_fl(const char *func, + int line, const char *fmt, ...); +#define pb_debug_fl(args...) _pb_debug_fl(__func__, __LINE__, args) + +void __pb_log_init(FILE *stream, bool debug); + +#ifdef DEBUG +#define pb_log_init(s) __pb_log_init(s, true) +#else +#define pb_log_init(s) __pb_log_init(s, false) +#endif + +void pb_log_set_debug(bool debug); +bool pb_log_get_debug(void); +FILE *pb_log_get_stream(void); #endif /* _LOG_H */