From 29a4871ab80a67a1a7245d969fecf5e08d8ee7e0 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 11 Nov 2015 15:08:19 +0100 Subject: [PATCH] core: Add function for logging with priority information --- src/log.c | 16 ++++++++++++++++ src/log.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/src/log.c b/src/log.c index 6a20b68eb..d2a20de78 100644 --- a/src/log.c +++ b/src/log.c @@ -180,6 +180,22 @@ void info(const char *format, ...) va_end(ap); } +void btd_log(uint16_t index, int priority, const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + vsyslog(priority, format, ap); + va_end(ap); + + if (logging_fd < 0) + return; + + va_start(ap, format); + logging_log(index, priority, format, ap); + va_end(ap); +} + void btd_error(uint16_t index, const char *format, ...) { va_list ap; diff --git a/src/log.h b/src/log.h index f40fb31e9..0d243ceca 100644 --- a/src/log.h +++ b/src/log.h @@ -27,6 +27,9 @@ void error(const char *format, ...) __attribute__((format(printf, 1, 2))); void warn(const char *format, ...) __attribute__((format(printf, 1, 2))); void info(const char *format, ...) __attribute__((format(printf, 1, 2))); +void btd_log(uint16_t index, int priority, const char *format, ...) + __attribute__((format(printf, 3, 4))); + void btd_error(uint16_t index, const char *format, ...) __attribute__((format(printf, 2, 3))); void btd_warn(uint16_t index, const char *format, ...) -- 2.47.3