aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2024-03-14 12:11:11 -0700
committerYann Collet <cyan@fb.com>2024-03-14 12:11:11 -0700
commit9cc3304614f9ea28a870f9e94e1e449c6d7de1fc (patch)
tree1d958fe97ecb15e9b12e220977e0ab69b6c108e1
parent7c2aa73a8ef16e387b57e54cf2b71588c539fbfb (diff)
downloadzstd-9cc3304614f9ea28a870f9e94e1e449c6d7de1fc.tar.gz
add line number to debug traces
-rw-r--r--lib/common/debug.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/common/debug.h b/lib/common/debug.h
index 8049e4b5..a16b69e5 100644
--- a/lib/common/debug.h
+++ b/lib/common/debug.h
@@ -92,10 +92,14 @@ extern int g_debuglevel; /* the variable is only declared,
} \
} while (0)
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
+#define LINE_AS_STRING TOSTRING(__LINE__)
+
# define DEBUGLOG(l, ...) \
do { \
if (l<=g_debuglevel) { \
- ZSTD_DEBUG_PRINT(__FILE__ ": " __VA_ARGS__); \
+ ZSTD_DEBUG_PRINT(__FILE__ ":" LINE_AS_STRING ": " __VA_ARGS__); \
ZSTD_DEBUG_PRINT(" \n"); \
} \
} while (0)