From 9ac040f72a0b5e44e55335a7e447ed2b2f1d3a39 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 20 Dec 2024 15:41:47 +1000 Subject: [PATCH] util: add etrace to trace to stderr Part-of: --- src/libinput-util.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libinput-util.h b/src/libinput-util.h index 0ca522ce..7a2c0a92 100644 --- a/src/libinput-util.h +++ b/src/libinput-util.h @@ -57,13 +57,16 @@ #define DEFAULT_MOUSE_DPI 1000 #define DEFAULT_TRACKPOINT_SENSITIVITY 128 -#define trace(...) \ +#define _trace(file, ...) \ do { \ char buf_[1024]; \ snprintf(buf_, sizeof(buf_), __VA_ARGS__); \ - printf(ANSI_BLUE "%s():%d - " ANSI_RED "%s" ANSI_NORMAL "\n", __func__, __LINE__, buf_); \ + fprintf(file, ANSI_BLUE "%s():%d - " ANSI_RED "%s" ANSI_NORMAL "\n", __func__, __LINE__, buf_); \ } while (0) +#define trace(...) _trace(stdout, __VA_ARGS__) +#define etrace(...) _trace(stderr, __VA_ARGS__) + #define LIBINPUT_EXPORT __attribute__ ((visibility("default"))) #define LIBINPUT_UNUSED __attribute__ ((unused))