OSDN Git Service

core: Add function for logging with priority information
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 11 Nov 2015 14:08:19 +0000 (15:08 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 11 Nov 2015 14:08:19 +0000 (15:08 +0100)
src/log.c
src/log.h

index 6a20b68..d2a20de 100644 (file)
--- 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;
index f40fb31..0d243ce 100644 (file)
--- 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, ...)