Hi,
On 14-02-17 02:58, Peter Hutterer wrote:
makes it easier to filter out debugging messages
Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
Sorry, used the wrong patch, v1 was an earlier version.
v2 looks good to me:
Reviewed-by: Hans de Goede <hdego...@redhat.com>
Regards,
Hans
tools/shared.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/tools/shared.c b/tools/shared.c
index 1019184..81608c0 100644
--- a/tools/shared.c
+++ b/tools/shared.c
@@ -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
_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel