summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common/ldb_debug.c
diff options
context:
space:
mode:
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