From dae4540e417e2bf72dd83b2713a670bde0056ba9 Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Wed, 21 Jan 2009 16:26:56 -0800 Subject: 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 Signed-off-by: Jeremy Kerr --- lib/log/log.c | 23 +++++++++++++++++++++++ lib/log/log.h | 9 +++++++++ 2 files changed, 32 insertions(+) create mode 100644 lib/log/log.c create mode 100644 lib/log/log.h (limited to 'lib/log') 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 + +#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 + +void pb_log(const char *fmt, ...); +void pb_log_set_stream(FILE *stream); + +#endif /* _LOG_H */ -- cgit v1.2.1