From d19b3e8e6e6b3a98801e73c654e03cba61f35aba Mon Sep 17 00:00:00 2001 From: zhongkaizhu Date: Wed, 21 Apr 2021 21:04:38 +0800 Subject: [PATCH] log: print filename and line number --- src/log.c | 2 +- src/log.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/log.c b/src/log.c index cd7c2d51..58c9feb0 100644 --- a/src/log.c +++ b/src/log.c @@ -61,7 +61,7 @@ static int level_to_syslog_level(int level) return result; } -void usbmuxd_log(enum loglevel level, const char *fmt, ...) +void usbmuxd_logx(enum loglevel level, const char *fmt, ...) { va_list ap; char *fs; diff --git a/src/log.h b/src/log.h index 858e7d00..ebb9874e 100644 --- a/src/log.h +++ b/src/log.h @@ -37,6 +37,8 @@ extern unsigned int log_level; void log_enable_syslog(); void log_disable_syslog(); -void usbmuxd_log(enum loglevel level, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); +void usbmuxd_logx(enum loglevel level, const char* fmt, ...) __attribute__ ((format (printf, 2, 3))); +#define usbmuxd_log(level, fmt, ...) \ + usbmuxd_logx(level, "%s:%d " fmt , __FILE__, __LINE__, ##__VA_ARGS__) #endif