mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-05-04 23:38:01 +02:00
util: Add the trace() debugging macro
Copied from libinput but pushed into util-macros with the color escape codes expanded for simplicity. Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/315>
This commit is contained in:
parent
327dd4f8b1
commit
b33317cda0
1 changed files with 7 additions and 0 deletions
|
|
@ -65,3 +65,10 @@
|
|||
#define run_only_once \
|
||||
static int _once_per_##__func__ = 0; \
|
||||
for (; _once_per_##__func__ == 0; _once_per_##__func__ = 1)
|
||||
|
||||
#define trace(...) \
|
||||
do { \
|
||||
char buf_[1024]; \
|
||||
snprintf(buf_, sizeof(buf_), __VA_ARGS__); \
|
||||
printf("\x1B[0;34m" "%s():%d - " "\x1B[0;31m" "%s" "\x1B[0m" "\n", __func__, __LINE__, buf_); \
|
||||
} while (0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue