mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 09:20:29 +01:00
evdev: log all evdev_msg_* on one line
So we don't have to have newline handling in the callers. This effectively
reverts 6ab2999be9 "test: detect linebreaks in log messages".
https://bugs.freedesktop.org/show_bug.cgi?id=104957
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
parent
bb431ae20d
commit
d4b76be18b
2 changed files with 14 additions and 24 deletions
23
src/evdev.h
23
src/evdev.h
|
|
@ -666,19 +666,18 @@ evdev_log_msg_va(struct evdev_device *device,
|
|||
const char *format,
|
||||
va_list args)
|
||||
{
|
||||
/* Anything info and above is user-visible, use the device name */
|
||||
log_msg(evdev_libinput_context(device),
|
||||
priority,
|
||||
"%-7s - %s%s",
|
||||
evdev_device_get_sysname(device),
|
||||
(priority > LIBINPUT_LOG_PRIORITY_DEBUG) ? device->devname : "",
|
||||
(priority > LIBINPUT_LOG_PRIORITY_DEBUG) ? ": " : ""
|
||||
);
|
||||
char buf[1024];
|
||||
|
||||
log_msg_va(evdev_libinput_context(device),
|
||||
priority,
|
||||
format,
|
||||
args);
|
||||
/* 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);
|
||||
|
||||
log_msg_va(evdev_libinput_context(device), priority, buf, args);
|
||||
}
|
||||
|
||||
LIBINPUT_ATTRIBUTE_PRINTF(3, 4)
|
||||
|
|
|
|||
|
|
@ -636,7 +636,6 @@ litest_log_handler(struct libinput *libinput,
|
|||
va_list args)
|
||||
{
|
||||
static int is_tty = -1;
|
||||
static bool had_newline = true;
|
||||
const char *priority = NULL;
|
||||
const char *color;
|
||||
|
||||
|
|
@ -662,11 +661,7 @@ litest_log_handler(struct libinput *libinput,
|
|||
|
||||
if (!is_tty)
|
||||
color = "";
|
||||
|
||||
if (had_newline)
|
||||
fprintf(stderr, "%slitest %s ", color, priority);
|
||||
|
||||
if (strstr(format, "tap state:"))
|
||||
else if (strstr(format, "tap state:"))
|
||||
color = ANSI_BLUE;
|
||||
else if (strstr(format, "thumb state:"))
|
||||
color = ANSI_YELLOW;
|
||||
|
|
@ -681,13 +676,9 @@ litest_log_handler(struct libinput *libinput,
|
|||
else if (strstr(format, "edge state:"))
|
||||
color = ANSI_BRIGHT_GREEN;
|
||||
|
||||
if (is_tty)
|
||||
fprintf(stderr, "%s ", color);
|
||||
|
||||
fprintf(stderr, "%slitest %s ", color, priority);
|
||||
vfprintf(stderr, format, args);
|
||||
had_newline = strlen(format) >= 1 &&
|
||||
format[strlen(format) - 1] == '\n';
|
||||
if (is_tty && had_newline)
|
||||
if (is_tty)
|
||||
fprintf(stderr, ANSI_NORMAL);
|
||||
|
||||
if (strstr(format, "client bug: ") ||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue