summaryrefslogtreecommitdiff
path: root/src/log.h
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-11-08 02:33:22 +0100
committerMarcel Holtmann <marcel@holtmann.org>2015-11-08 02:33:22 +0100
commitdcfdc5567ecee2a4989ab445d213a67447158434 (patch)
treee61814bf267560ab54b0caaa0f1f4fa01f8b479a /src/log.h
parent1e95c542346a88f21d09e0ea7490f074f6f9610a (diff)
downloadbluez-dcfdc5567ecee2a4989ab445d213a67447158434.tar.gz
core: Add logging functions for controller specific messages
Diffstat (limited to 'src/log.h')
-rw-r--r--src/log.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/log.h b/src/log.h
index bf9eac2aa..f40fb31e9 100644
--- a/src/log.h
+++ b/src/log.h
@@ -21,11 +21,20 @@
*
*/
-void info(const char *format, ...) __attribute__((format(printf, 1, 2)));
-void warn(const char *format, ...) __attribute__((format(printf, 1, 2)));
+#include <stdint.h>
+
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_debug(const char *format, ...) __attribute__((format(printf, 1, 2)));
+void btd_error(uint16_t index, const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
+void btd_warn(uint16_t index, const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
+void btd_info(uint16_t index, const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
+void btd_debug(uint16_t index, const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
void __btd_log_init(const char *debug, int detach);
void __btd_log_cleanup(void);
@@ -49,11 +58,13 @@ void __btd_enable_debug(struct btd_debug_desc *start,
* Simple macro around btd_debug() which also include the function
* name it is called in.
*/
-#define DBG(fmt, arg...) do { \
+#define DBG_IDX(idx, fmt, arg...) do { \
static struct btd_debug_desc __btd_debug_desc \
__attribute__((used, section("__debug"), aligned(8))) = { \
.file = __FILE__, .flags = BTD_DEBUG_FLAG_DEFAULT, \
}; \
if (__btd_debug_desc.flags & BTD_DEBUG_FLAG_PRINT) \
- btd_debug("%s:%s() " fmt, __FILE__, __func__ , ## arg); \
+ btd_debug(idx, "%s:%s() " fmt, __FILE__, __func__ , ## arg); \
} while (0)
+
+#define DBG(fmt, arg...) DBG_IDX(0xffff, fmt, ## arg)