From cb41ff2922b8a555c01d52e1038ac26360253c15 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Wed, 22 Oct 2014 23:27:57 -0500 Subject: shared/log: add log_trace as compile-time optional debugging Repetetive messages can be annoying when running with SYSTEMD_LOG_LEVEL=debug, but they are sometimes very useful when debugging problems. Add log_trace which is like log_debug but becomes a noop unless LOG_TRACE is defined during compilation. This makes it easy to enable very verbose logging for a subset of programs when compiling from source. --- src/shared/log.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/shared') diff --git a/src/shared/log.h b/src/shared/log.h index 9918381d39..a3e23a855c 100644 --- a/src/shared/log.h +++ b/src/shared/log.h @@ -157,6 +157,12 @@ do { \ #define log_warning(...) log_full(LOG_WARNING, __VA_ARGS__) #define log_error(...) log_full(LOG_ERR, __VA_ARGS__) +#ifdef LOG_TRACE +# define log_trace(...) log_debug(__VA_ARGS__) +#else +# define log_trace(...) do {} while(0) +#endif + #define log_struct(level, ...) log_struct_internal(level, __FILE__, __LINE__, __func__, __VA_ARGS__) #define log_oom() log_oom_internal(__FILE__, __LINE__, __func__) -- cgit v1.2.3-54-g00ecf