unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: libnotmuch logging overhaul v3
Date: Sun, 28 Dec 2014 18:33:44 +0100	[thread overview]
Message-ID: <1419788030-10567-1-git-send-email-david@tethera.net> (raw)

changes since the last round [1]

- remove unused variable
- fix the internal usage of n_d_open to use _verbose version
- revert the hiding of query debugging.

[1]: id:1419717937-1108-2-git-send-email-david@tethera.net

diff --git a/lib/database.cc b/lib/database.cc
index 16cd940..b144885 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -377,7 +377,6 @@ _notmuch_database_log (notmuch_database_t *notmuch,
 		      ...)
 {
     va_list va_args;
-    const char *message;
 
     va_start (va_args, format);
 
@@ -693,9 +692,9 @@ notmuch_database_create_verbose (const char *path,
 	goto DONE;
     }
 
-    status = notmuch_database_open (path,
-				    NOTMUCH_DATABASE_MODE_READ_WRITE,
-				    &notmuch);
+    status = notmuch_database_open_verbose (path,
+					    NOTMUCH_DATABASE_MODE_READ_WRITE,
+					    &notmuch, &message);
     if (status)
 	goto DONE;
 
@@ -1101,13 +1100,18 @@ notmuch_database_compact (const char *path,
     notmuch_database_t *notmuch = NULL;
     struct stat statbuf;
     notmuch_bool_t keep_backup;
+    char *message = NULL;
 
     local = talloc_new (NULL);
     if (! local)
 	return NOTMUCH_STATUS_OUT_OF_MEMORY;
 
-    ret = notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, &notmuch);
+    ret = notmuch_database_open_verbose (path,
+					 NOTMUCH_DATABASE_MODE_READ_WRITE,
+					 &notmuch,
+					 &message);
     if (ret) {
+	if (status_cb) status_cb (message, closure);
 	goto DONE;
     }
 
diff --git a/lib/query.cc b/lib/query.cc
index 2e20ab2..9ed420c 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -78,7 +78,7 @@ notmuch_query_create (notmuch_database_t *notmuch,
     notmuch_query_t *query;
 
     if (_debug_query ())
-	_notmuch_database_log (notmuch, "Query string is:\n%s\n", query_string);
+	fprintf (stderr, "Query string is:\n%s\n", query_string);
 
     query = talloc (notmuch, notmuch_query_t);
     if (unlikely (query == NULL))
@@ -266,9 +266,9 @@ notmuch_query_search_messages (notmuch_query_t *query)
 	}
 
 	if (_debug_query ()) {
-	    _notmuch_database_log (notmuch, "Exclude query is:\n%s\n",
+	    fprintf (stderr, "Exclude query is:\n%s\n",
 		     exclude_query.get_description ().c_str ());
-	    _notmuch_database_log (notmuch, "Final query is:\n%s\n",
+	    fprintf (stderr, "Final query is:\n%s\n",
 		     final_query.get_description ().c_str ());
 	}
 
@@ -549,9 +549,9 @@ notmuch_query_count_messages (notmuch_query_t *query)
 	enquire.set_docid_order(Xapian::Enquire::ASCENDING);
 
 	if (_debug_query ()) {
-	    _notmuch_database_log (notmuch, "Exclude query is:\n%s\n",
+	    fprintf (stderr, "Exclude query is:\n%s\n",
 		     exclude_query.get_description ().c_str ());
-	    _notmuch_database_log (notmuch, "Final query is:\n%s\n",
+	    fprintf (stderr, "Final query is:\n%s\n",
 		     final_query.get_description ().c_str ());
 	}
 

 lib/database.cc | 14 +++++++++-----
 lib/query.cc    | 10 +++++-----
 2 files changed, 14 insertions(+), 10 deletions(-)

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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-28 17:33 David Bremner [this message]
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 ` [Patch v3 3/6] lib: add a log function with output to a string in notmuch_database_t David Bremner
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-1-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).