summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common/ldb_debug.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-21 17:52:21 -0700
committerAndrew Tridgell <tridge@samba.org>2009-09-22 17:10:05 -0700
commitec5d01278a6f38f76eb6edfa2e9bfb2fc8eb6fbe (patch)
tree4258ff129c089f31bd1e4f293e5581e5318697a9 /source4/lib/ldb/common/ldb_debug.c
parent1544c2b66c84f5bc7a773aa1a4aa4589d766a6d5 (diff)
downloadsamba-ec5d01278a6f38f76eb6edfa2e9bfb2fc8eb6fbe.tar.gz
samba-ec5d01278a6f38f76eb6edfa2e9bfb2fc8eb6fbe.tar.bz2
samba-ec5d01278a6f38f76eb6edfa2e9bfb2fc8eb6fbe.zip
s4-ldb: don't show timestamps on every line of ldb traces
This adds ldb_debug_add() and ldb_debug_end() to format multiline messages
Diffstat (limited to 'source4/lib/ldb/common/ldb_debug.c')
-rw-r--r--source4/lib/ldb/common/ldb_debug.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source4/lib/ldb/common/ldb_debug.c b/source4/lib/ldb/common/ldb_debug.c
index 4612b016f6..6aa58ccf71 100644
--- a/source4/lib/ldb/common/ldb_debug.c
+++ b/source4/lib/ldb/common/ldb_debug.c
@@ -96,6 +96,31 @@ void ldb_debug(struct ldb_context *ldb, enum ldb_debug_level level, const char *
va_end(ap);
}
+/*
+ add to an accumulated log message
+ */
+void ldb_debug_add(struct ldb_context *ldb, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ if (ldb->partial_debug == NULL) {
+ ldb->partial_debug = talloc_vasprintf(ldb, fmt, ap);
+ } else {
+ ldb->partial_debug = talloc_vasprintf_append(ldb->partial_debug,
+ fmt, ap);
+ }
+ va_end(ap);
+}
+
+/*
+ send the accumulated log message, and free it
+ */
+void ldb_debug_end(struct ldb_context *ldb, enum ldb_debug_level level)
+{
+ ldb_debug(ldb, level, "%s", ldb->partial_debug);
+ talloc_free(ldb->partial_debug);
+ ldb->partial_debug = NULL;
+}
/*
log a message, and set the ldb error string to the same message