diff --git a/src/evdev.h b/src/evdev.h index 5e5319cd..cb765344 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -703,13 +703,14 @@ evdev_hysteresis(const struct device_coords *in, return result; } -LIBINPUT_ATTRIBUTE_PRINTF(3, 0) +LIBINPUT_ATTRIBUTE_PRINTF(3, 4) static inline void -evdev_log_msg_va(struct evdev_device *device, - enum libinput_log_priority priority, - const char *format, - va_list args) +evdev_log_msg(struct evdev_device *device, + enum libinput_log_priority priority, + const char *format, + ...) { + va_list args; char buf[1024]; /* Anything info and above is user-visible, use the device name */ @@ -721,20 +722,8 @@ evdev_log_msg_va(struct evdev_device *device, (priority > LIBINPUT_LOG_PRIORITY_DEBUG) ? ": " : "", format); - log_msg_va(evdev_libinput_context(device), priority, buf, args); -} - -LIBINPUT_ATTRIBUTE_PRINTF(3, 4) -static inline void -evdev_log_msg(struct evdev_device *device, - enum libinput_log_priority priority, - const char *format, - ...) -{ - va_list args; - va_start(args, format); - evdev_log_msg_va(device, priority, format, args); + log_msg_va(evdev_libinput_context(device), priority, buf, args); va_end(args); } @@ -748,14 +737,25 @@ evdev_log_msg_ratelimit(struct evdev_device *device, ...) { va_list args; + char buf[1024]; + enum ratelimit_state state; state = ratelimit_test(ratelimit); if (state == RATELIMIT_EXCEEDED) return; + /* Anything info and above is user-visible, use the device name */ + snprintf(buf, + sizeof(buf), + "%-7s - %s%s%s", + evdev_device_get_sysname(device), + (priority > LIBINPUT_LOG_PRIORITY_DEBUG) ? device->devname : "", + (priority > LIBINPUT_LOG_PRIORITY_DEBUG) ? ": " : "", + format); + va_start(args, format); - evdev_log_msg_va(device, priority, format, args); + log_msg_va(evdev_libinput_context(device), priority, buf, args); va_end(args); if (state == RATELIMIT_THRESHOLD)