From a926afe8dee8fe615dcc9dfb8bf99d3fd95cc574 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 11 Oct 2017 14:39:09 +1000 Subject: [PATCH] ratbagd: standardise the log messages a bit better Prefix with the sysname of the device, then have a 'failed to ...' Signed-off-by: Peter Hutterer --- ratbagd/ratbagd-device.c | 16 ++++++++-------- ratbagd/ratbagd-profile.c | 12 ++++++------ ratbagd/ratbagd.c | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ratbagd/ratbagd-device.c b/ratbagd/ratbagd-device.c index 2aeca4a2..38417d2e 100644 --- a/ratbagd/ratbagd-device.c +++ b/ratbagd/ratbagd-device.c @@ -125,7 +125,7 @@ static int ratbagd_device_get_device_name(sd_bus *bus, name = ratbag_device_get_name(device->lib_device); if (!name) { - log_error("Unable to fetch name for %s\n", + log_error("%s: failed to fetch name\n", ratbagd_device_get_sysname(device)); name = ""; } @@ -146,7 +146,7 @@ static int ratbagd_device_get_svg(sd_bus *bus, svg = ratbag_device_get_svg_name(device->lib_device); if (!svg) { - log_error("Unable to fetch SVG for %s\n", + log_error("%s: failed to fetch SVG\n", ratbagd_device_get_sysname(device)); svg = ""; } @@ -171,7 +171,7 @@ static int ratbagd_device_get_theme_svg(sd_bus_message *m, svg = ratbag_device_get_svg_name(device->lib_device); if (!svg) { - log_error("Unable to fetch SVG for %s, using fallback\n", + log_error("%s: failed to fetch SVG, using fallback\n", ratbagd_device_get_sysname(device)); svg = FALLBACK_SVG_NAME; } @@ -335,7 +335,7 @@ int ratbagd_device_new(struct ratbagd_device **out, i); if (r < 0) { errno = -r; - log_error("Cannot allocate profile for '%s': %m\n", + log_error("%s: failed to allocate profile: %m\n", device->sysname); } } @@ -460,7 +460,7 @@ void ratbagd_device_link(struct ratbagd_device *device) } if (r < 0) { errno = -r; - log_error("Cannot register profile interfaces for '%s': %m\n", + log_error("%s: failed to register profile interfaces: %m\n", device->sysname); return; } @@ -470,7 +470,7 @@ void ratbagd_device_link(struct ratbagd_device *device) device, device->profiles[i]); if (r < 0) { - log_error("Cannot register resolutions for '%s': %m\n", + log_error("%s: failed to register resolutions: %m\n", device->sysname); } @@ -478,7 +478,7 @@ void ratbagd_device_link(struct ratbagd_device *device) device, device->profiles[i]); if (r < 0) { - log_error("Cannot register buttons for '%s': %m\n", + log_error("%s: failed to register buttons: %m\n", device->sysname); } @@ -486,7 +486,7 @@ void ratbagd_device_link(struct ratbagd_device *device) device, device->profiles[i]); if (r < 0) { - log_error("Cannot register leds for '%s': %m\n", + log_error("%s: failed to register leds: %m\n", device->sysname); } } diff --git a/ratbagd/ratbagd-profile.c b/ratbagd/ratbagd-profile.c index f19fdaf5..36738df7 100644 --- a/ratbagd/ratbagd-profile.c +++ b/ratbagd/ratbagd-profile.c @@ -500,7 +500,7 @@ int ratbagd_profile_new(struct ratbagd_profile **out, i); if (r < 0) { errno = -r; - log_error("Cannot allocate resolution for '%s': %m\n", + log_error("%s: failed to allocate resolution: %m\n", ratbagd_device_get_sysname(device)); } } @@ -517,7 +517,7 @@ int ratbagd_profile_new(struct ratbagd_profile **out, i); if (r < 0) { errno = -r; - log_error("Cannot allocate button for '%s': %m\n", + log_error("%s: failed to allocate button: %m\n", ratbagd_device_get_sysname(device)); } } @@ -534,7 +534,7 @@ int ratbagd_profile_new(struct ratbagd_profile **out, i); if (r < 0) { errno = -r; - log_error("Cannot allocate led for '%s': %m\n", + log_error("%s: failed to allocate led: %m\n", ratbagd_device_get_sysname(device)); } } @@ -647,7 +647,7 @@ int ratbagd_profile_register_resolutions(struct sd_bus *bus, } if (r < 0) { errno = -r; - log_error("Cannot register resolutions for '%s': %m\n", + log_error("%s: failed to register resolutions: %m\n", ratbagd_device_get_sysname(device)); } @@ -713,7 +713,7 @@ int ratbagd_profile_register_buttons(struct sd_bus *bus, } if (r < 0) { errno = -r; - log_error("Cannot register buttons for '%s': %m\n", + log_error("%s: failed to register buttons: %m\n", ratbagd_device_get_sysname(device)); } @@ -779,7 +779,7 @@ int ratbagd_profile_register_leds(struct sd_bus *bus, } if (r < 0) { errno = -r; - log_error("Cannot register leds for '%s': %m\n", + log_error("%s: failed to register leds: %m\n", ratbagd_device_get_sysname(device)); } diff --git a/ratbagd/ratbagd.c b/ratbagd/ratbagd.c index a0334a17..92b5dc5e 100644 --- a/ratbagd/ratbagd.c +++ b/ratbagd/ratbagd.c @@ -251,7 +251,7 @@ static void ratbagd_process_device(struct ratbagd *ctx, ratbag_device_unref(lib_device); if (r < 0) { - log_error("Cannot track device '%s'\n", name); + log_error("%s: cannot track device\n", name); return; }