diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-10-22 23:27:57 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2014-10-25 11:40:24 -0400 |
commit | a79876e097b87ede8c75301a99e4cd964b83a933 (patch) | |
tree | 6b3b7af8d794b07b840c8c44f53ca6633e1e4a6a /src/shared/log.h | |
parent | e5d31af2dfb0ce5b86a861dd03e8c12a7f29e984 (diff) |
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.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/shared/log.h')
-rw-r--r-- | src/shared/log.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/shared/log.h b/src/shared/log.h index 70d3ec2f61..30f0cacb65 100644 --- a/src/shared/log.h +++ b/src/shared/log.h @@ -97,6 +97,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__) |