unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [Patch v3 3/6] lib: add a log function with output to a string in notmuch_database_t
Date: Sun, 28 Dec 2014 18:33:47 +0100	[thread overview]
Message-ID: <1419788030-10567-4-git-send-email-david@tethera.net> (raw)
In-Reply-To: <1419788030-10567-1-git-send-email-david@tethera.net>

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 18db902..9af1a47 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -371,6 +371,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 012ad25..7c6cfc0 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -191,6 +191,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.3

  parent reply	other threads:[~2014-12-28 17:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-28 17:33 libnotmuch logging overhaul v3 David Bremner
2014-12-28 17:33 ` [Patch v3 1/6] lib: add "verbose" versions of notmuch_database_{open,create} David Bremner
2014-12-28 17:33 ` [Patch v3 2/6] lib/database: add field for last error string David Bremner
2014-12-28 17:33 ` David Bremner [this message]
2014-12-28 17:33 ` [Patch v3 4/6] lib: add private function to extract the database for a message David Bremner
2014-12-28 17:33 ` [Patch v3 5/6] lib: replace almost all fprintfs in library with _n_d_log David Bremner
2014-12-28 17:33 ` [Patch v3 6/6] lib: eliminate fprintf from _notmuch_message_file_open David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1419788030-10567-4-git-send-email-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).