mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 11:40:30 +01:00
tools: print errors as red, info as highlighted
makes it easier to filter out debugging messages Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
63fcf46951
commit
92196ce555
1 changed files with 18 additions and 0 deletions
|
|
@ -72,7 +72,25 @@ log_handler(struct libinput *li,
|
|||
const char *format,
|
||||
va_list args)
|
||||
{
|
||||
#define ANSI_HIGHLIGHT "\x1B[0;1;39m"
|
||||
#define ANSI_RED "\x1B[0;31m"
|
||||
#define ANSI_NORMAL "\x1B[0m"
|
||||
static int is_tty = -1;
|
||||
|
||||
if (is_tty == -1)
|
||||
is_tty = isatty(STDOUT_FILENO);
|
||||
|
||||
if (is_tty) {
|
||||
if (priority >= LIBINPUT_LOG_PRIORITY_ERROR)
|
||||
printf(ANSI_RED);
|
||||
else if (priority >= LIBINPUT_LOG_PRIORITY_INFO)
|
||||
printf(ANSI_HIGHLIGHT);
|
||||
}
|
||||
|
||||
vprintf(format, args);
|
||||
|
||||
if (is_tty && priority >= LIBINPUT_LOG_PRIORITY_INFO)
|
||||
printf(ANSI_NORMAL);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue