evdev: inline evdev_log_msg_va
authorKonstantin Kharlamov <Hi-Angel@yandex.ru>
Fri, 11 Jan 2019 22:57:08 +0000 (01:57 +0300)
committerKonstantin Kharlamov <Hi-Angel@yandex.ru>
Thu, 17 Jan 2019 06:10:37 +0000 (09:10 +0300)
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
src/evdev.h

index 5e5319cdb6e2fa5d8702710c8c887f09ed638c3d..cb7653449062207f5c802ebfd60b4413f492ff96 100644 (file)
@@ -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)