From ec5d01278a6f38f76eb6edfa2e9bfb2fc8eb6fbe Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 21 Sep 2009 17:52:21 -0700 Subject: 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 --- source4/lib/ldb/common/ldb_debug.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source4/lib/ldb/common/ldb_debug.c') 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 -- cgit