diff options
author | Simo Sorce <ssorce@redhat.com> | 2009-07-14 17:01:26 -0400 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-07-20 14:37:35 -0400 |
commit | 6c1d176dc9ad42d14727778248ec68628cb4daa1 (patch) | |
tree | 92b0474c2ad65eb09d7676563f3da1ff971e7d32 /server/util/util.h | |
parent | bb4570d2f3ed0c9b780010623de82c4c76d15a2c (diff) | |
download | sssd-6c1d176dc9ad42d14727778248ec68628cb4daa1.tar.gz sssd-6c1d176dc9ad42d14727778248ec68628cb4daa1.tar.xz sssd-6c1d176dc9ad42d14727778248ec68628cb4daa1.zip |
Add option to add timestamps to debug output
use '--debug-timestamps' at the command line
or set 'debug-timestamps = TRUE' in the configuration file.
Diffstat (limited to 'server/util/util.h')
-rw-r--r-- | server/util/util.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/server/util/util.h b/server/util/util.h index fac3ea549..02916c191 100644 --- a/server/util/util.h +++ b/server/util/util.h @@ -8,6 +8,7 @@ #include <string.h> #include <errno.h> #include <limits.h> +#include <time.h> #include "config.h" #include "talloc.h" #include "tevent.h" @@ -15,11 +16,14 @@ extern const char *debug_prg_name; extern int debug_level; +extern int debug_timestamps; void debug_fn(const char *format, ...); #define SSSD_DEBUG_OPTS \ {"debug-level", 'd', POPT_ARG_INT, &debug_level, 0, \ - "Debug level", NULL}, + "Debug level", NULL}, \ + {"debug-timestamps", 0, POPT_ARG_NONE, &debug_timestamps, 0, \ + "Add debug timestamps", NULL}, /** \def DEBUG(level, body) \brief macro to generate debug messages @@ -37,8 +41,13 @@ void debug_fn(const char *format, ...); */ #define DEBUG(level, body) do { \ if (level <= debug_level) { \ - debug_fn("[%s] [%s] (%d): ", \ - debug_prg_name, __FUNCTION__, level); \ + if (debug_timestamps) { \ + debug_fn("(%010ld) [%s] [%s] (%d): ", \ + (long)time(NULL), debug_prg_name, __FUNCTION__, level); \ + } else { \ + debug_fn("[%s] [%s] (%d): ", \ + debug_prg_name, __FUNCTION__, level); \ + } \ debug_fn body; \ } \ } while(0); |