diff options
author | Geoff Levand <geoffrey.levand@am.sony.com> | 2009-01-21 16:26:56 -0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2009-02-01 11:49:29 +1100 |
commit | dae4540e417e2bf72dd83b2713a670bde0056ba9 (patch) | |
tree | bf6f168b7f865e3a35eda16879c2d43637056b3f /lib | |
parent | 6106bb6672af26232546c07a4b631779f21dbbb0 (diff) | |
download | talos-petitboot-dae4540e417e2bf72dd83b2713a670bde0056ba9.tar.gz talos-petitboot-dae4540e417e2bf72dd83b2713a670bde0056ba9.zip |
Move log to library
Move the log routines to the petitboot library. The log
routines are generic enough to be used for both server and
client. Does not change the log source.
jk: move to lib/log/ instead of lib/
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/log/log.c | 23 | ||||
-rw-r--r-- | lib/log/log.h | 9 |
2 files changed, 32 insertions, 0 deletions
diff --git a/lib/log/log.c b/lib/log/log.c new file mode 100644 index 0000000..e006fd0 --- /dev/null +++ b/lib/log/log.c @@ -0,0 +1,23 @@ + +#include <stdarg.h> + +#include "log.h" + +static FILE *logf; + +void pb_log(const char *fmt, ...) +{ + va_list ap; + FILE *stream; + + stream = logf ? logf : stdout; + + va_start(ap, fmt); + vfprintf(stream, fmt, ap); + va_end(ap); +} + +void pb_log_set_stream(FILE *stream) +{ + logf = stream; +} diff --git a/lib/log/log.h b/lib/log/log.h new file mode 100644 index 0000000..3e92555 --- /dev/null +++ b/lib/log/log.h @@ -0,0 +1,9 @@ +#ifndef _LOG_H +#define _LOG_H + +#include <stdio.h> + +void pb_log(const char *fmt, ...); +void pb_log_set_stream(FILE *stream); + +#endif /* _LOG_H */ |