[Patch v4 6/9] lib: add a log function with output to a string in notmuch_database_t

David Bremner david at tethera.net
Sat Mar 14 10:02:31 PDT 2015


This is a thin wrapper around the previously implemented string
logging infrastructure. In the future it could have more configurable
output options.
---
 lib/database.cc       | 14 ++++++++++++++
 lib/notmuch-private.h |  4 ++++
 2 files changed, 18 insertions(+)

diff --git a/lib/database.cc b/lib/database.cc
index 48a830f..0409128 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -377,6 +377,20 @@ log_to_string (char **str,
     va_end (va_args);
 }
 
+void
+_notmuch_database_log (notmuch_database_t *notmuch,
+		      const char *format,
+		      ...)
+{
+    va_list va_args;
+
+    va_start (va_args, format);
+
+    vlog_to_string (notmuch, &notmuch->status_string, format, va_args);
+
+    va_end (va_args);
+}
+
 static void
 find_doc_ids_for_term (notmuch_database_t *notmuch,
 		       const char *term,
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index 8a1f2fa..7cb6fd4 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -190,6 +190,10 @@ _notmuch_message_id_compressed (void *ctx, const char *message_id);
 notmuch_status_t
 _notmuch_database_ensure_writable (notmuch_database_t *notmuch);
 
+void
+_notmuch_database_log (notmuch_database_t *notmuch,
+		       const char *format, ...);
+
 const char *
 _notmuch_database_relative_path (notmuch_database_t *notmuch,
 				 const char *path);
-- 
2.1.4



More information about the notmuch mailing list