diff options
Diffstat (limited to 'lib/log')
-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 */ |