diff options
Diffstat (limited to 'libcutils/klog.c')
-rw-r--r-- | libcutils/klog.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libcutils/klog.c b/libcutils/klog.c index d69fb10..d3c40df 100644 --- a/libcutils/klog.c +++ b/libcutils/klog.c @@ -49,18 +49,24 @@ void klog_init(void) #define LOG_BUF_MAX 512 -void klog_write(int level, const char *fmt, ...) +void klog_vwrite(int level, const char *fmt, va_list ap) { char buf[LOG_BUF_MAX]; - va_list ap; if (level > klog_level) return; if (klog_fd < 0) klog_init(); if (klog_fd < 0) return; - va_start(ap, fmt); vsnprintf(buf, LOG_BUF_MAX, fmt, ap); buf[LOG_BUF_MAX - 1] = 0; - va_end(ap); + write(klog_fd, buf, strlen(buf)); } + +void klog_write(int level, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + klog_vwrite(level, fmt, ap); + va_end(ap); +} |