mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-09 07:08:01 +02: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,
|
const char *format,
|
||||||
va_list args)
|
va_list args)
|
||||||
{
|
{
|
||||||
/* Anything info and above is user-visible, use the device name */
|
char buf[1024];
|
||||||
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) ? ": " : ""
|
|
||||||
);
|
|
||||||
|
|
||||||
log_msg_va(evdev_libinput_context(device),
|
/* Anything info and above is user-visible, use the device name */
|
||||||
priority,
|
snprintf(buf,
|
||||||
format,
|
sizeof(buf),
|
||||||
args);
|
"%-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)
|
LIBINPUT_ATTRIBUTE_PRINTF(3, 4)
|
||||||
|
|
|
||||||
|
|
@ -636,7 +636,6 @@ litest_log_handler(struct libinput *libinput,
|
||||||
va_list args)
|
va_list args)
|
||||||
{
|
{
|
||||||
static int is_tty = -1;
|
static int is_tty = -1;
|
||||||
static bool had_newline = true;
|
|
||||||
const char *priority = NULL;
|
const char *priority = NULL;
|
||||||
const char *color;
|
const char *color;
|
||||||
|
|
||||||
|
|
@ -662,11 +661,7 @@ litest_log_handler(struct libinput *libinput,
|
||||||
|
|
||||||
if (!is_tty)
|
if (!is_tty)
|
||||||
color = "";
|
color = "";
|
||||||
|
else if (strstr(format, "tap state:"))
|
||||||
if (had_newline)
|
|
||||||
fprintf(stderr, "%slitest %s ", color, priority);
|
|
||||||
|
|
||||||
if (strstr(format, "tap state:"))
|
|
||||||
color = ANSI_BLUE;
|
color = ANSI_BLUE;
|
||||||
else if (strstr(format, "thumb state:"))
|
else if (strstr(format, "thumb state:"))
|
||||||
color = ANSI_YELLOW;
|
color = ANSI_YELLOW;
|
||||||
|
|
@ -681,13 +676,9 @@ litest_log_handler(struct libinput *libinput,
|
||||||
else if (strstr(format, "edge state:"))
|
else if (strstr(format, "edge state:"))
|
||||||
color = ANSI_BRIGHT_GREEN;
|
color = ANSI_BRIGHT_GREEN;
|
||||||
|
|
||||||
if (is_tty)
|
fprintf(stderr, "%slitest %s ", color, priority);
|
||||||
fprintf(stderr, "%s ", color);
|
|
||||||
|
|
||||||
vfprintf(stderr, format, args);
|
vfprintf(stderr, format, args);
|
||||||
had_newline = strlen(format) >= 1 &&
|
if (is_tty)
|
||||||
format[strlen(format) - 1] == '\n';
|
|
||||||
if (is_tty && had_newline)
|
|
||||||
fprintf(stderr, ANSI_NORMAL);
|
fprintf(stderr, ANSI_NORMAL);
|
||||||
|
|
||||||
if (strstr(format, "client bug: ") ||
|
if (strstr(format, "client bug: ") ||
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue