diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-09-19 12:18:56 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2013-09-19 21:36:32 +0800 |
commit | 307b4b091e0bc298964e90888bf179431e32c134 (patch) | |
tree | 47cc758b0929eb29a216efd945b9ad46f4ffb19a /lib/log/log.h | |
parent | e52b37c27c267c882d82cd1e34412817b5a4dbce (diff) | |
download | talos-petitboot-307b4b091e0bc298964e90888bf179431e32c134.tar.gz talos-petitboot-307b4b091e0bc298964e90888bf179431e32c134.zip |
lib/log: Cleanup log API
Rather than exposing log internals (through always_flush and
set_stream), do all logging init through pb_log_init(). If pb_log_init()
hasn't been called, pb_log will drop messages.
Also, add a pb_debug() function, specifically for debugging information.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib/log/log.h')
-rw-r--r-- | lib/log/log.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/log/log.h b/lib/log/log.h index 6f44bea..e34de33 100644 --- a/lib/log/log.h +++ b/lib/log/log.h @@ -1,11 +1,20 @@ #ifndef _LOG_H #define _LOG_H +#include <stdbool.h> #include <stdio.h> void __attribute__ ((format (printf, 1, 2))) pb_log(const char *fmt, ...); -void pb_log_set_stream(FILE *stream); -FILE * pb_log_get_stream(void); -void pb_log_always_flush(int state); +void __attribute__ ((format (printf, 1, 2))) pb_debug(const char *fmt, ...); + +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 + +FILE *pb_log_get_stream(void); #endif /* _LOG_H */ |