aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-10-10 16:47:29 +0200
committerDrew DeVault <sir@cmpwn.com>2020-10-10 10:51:32 -0400
commit45c1a3621cc6874e5b5d9694015241668980df5d (patch)
treeeb51bdf13ae0db43f51f16135514719d27c30d2c /backend
parent86c0b9986b82a477dea7e6029c0fe565dd7af429 (diff)
backend/libinput: improve logger callback
- Add a prefix to make it clear log messages come from libinput - Properly convert libinput log priority to wlroots'
Diffstat (limited to 'backend')
-rw-r--r--backend/libinput/backend.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c
index 87497b11..3c42d7f8 100644
--- a/backend/libinput/backend.c
+++ b/backend/libinput/backend.c
@@ -44,9 +44,24 @@ static int handle_libinput_readable(int fd, uint32_t mask, void *_backend) {
return 0;
}
+static enum wlr_log_importance libinput_log_priority_to_wlr(
+ enum libinput_log_priority priority) {
+ switch (priority) {
+ case LIBINPUT_LOG_PRIORITY_ERROR:
+ return WLR_ERROR;
+ case LIBINPUT_LOG_PRIORITY_INFO:
+ return WLR_INFO;
+ default:
+ return WLR_DEBUG;
+ }
+}
+
static void log_libinput(struct libinput *libinput_context,
enum libinput_log_priority priority, const char *fmt, va_list args) {
- _wlr_vlog(WLR_ERROR, fmt, args);
+ enum wlr_log_importance importance = libinput_log_priority_to_wlr(priority);
+ static char wlr_fmt[1024];
+ snprintf(wlr_fmt, sizeof(wlr_fmt), "[libinput] %s", fmt);
+ _wlr_vlog(importance, wlr_fmt, args);
}
static bool backend_start(struct wlr_backend *wlr_backend) {