summaryrefslogtreecommitdiffstats
path: root/server/util/debug.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-07-14 17:01:26 -0400
committerSimo Sorce <ssorce@redhat.com>2009-07-20 14:37:35 -0400
commit6c1d176dc9ad42d14727778248ec68628cb4daa1 (patch)
tree92b0474c2ad65eb09d7676563f3da1ff971e7d32 /server/util/debug.c
parentbb4570d2f3ed0c9b780010623de82c4c76d15a2c (diff)
downloadsssd-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/debug.c')
-rw-r--r--server/util/debug.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/server/util/debug.c b/server/util/debug.c
index 24dcdb1d9..814aec1e1 100644
--- a/server/util/debug.c
+++ b/server/util/debug.c
@@ -7,6 +7,7 @@
const char *debug_prg_name = "sssd";
int debug_level = 0;
+int debug_timestamps = 0;
void debug_fn(const char *format, ...)
{
@@ -58,7 +59,13 @@ void ldb_debug_messages(void *context, enum ldb_debug_level level,
}
if (loglevel <= debug_level) {
- debug_fn("[%s] [ldb] (%d): %s\n", debug_prg_name, loglevel, message);
+ if (debug_timestamps) {
+ debug_fn("(%010ld) [%s] [ldb] (%d): %s\n",
+ (long)time(NULL), debug_prg_name, loglevel, message);
+ } else {
+ debug_fn("[%s] [ldb] (%d): %s\n",
+ debug_prg_name, loglevel, message);
+ }
}
free(message);
}