--- /dev/null
+Return-Path: <bremner@tesseract.cs.unb.ca>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id B3F12431FC4\r
+ for <notmuch@notmuchmail.org>; Sun, 28 Dec 2014 09:37:53 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id oFq2xBFWr5nl for <notmuch@notmuchmail.org>;\r
+ Sun, 28 Dec 2014 09:37:50 -0800 (PST)\r
+Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
+ (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 73754431FB6\r
+ for <notmuch@notmuchmail.org>; Sun, 28 Dec 2014 09:37:50 -0800 (PST)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+ (envelope-from <bremner@tesseract.cs.unb.ca>) id 1Y5Hmk-0002fM-EV\r
+ for notmuch@notmuchmail.org; Sun, 28 Dec 2014 13:37:46 -0400\r
+Received: (nullmailer pid 11491 invoked by uid 1000); Sun, 28 Dec 2014\r
+ 17:37:40 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: libnotmuch logging overhaul v3\r
+Date: Sun, 28 Dec 2014 18:33:44 +0100\r
+Message-Id: <1419788030-10567-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.1.3\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 28 Dec 2014 17:37:53 -0000\r
+\r
+changes since the last round [1]\r
+\r
+- remove unused variable\r
+- fix the internal usage of n_d_open to use _verbose version\r
+- revert the hiding of query debugging.\r
+\r
+[1]: id:1419717937-1108-2-git-send-email-david@tethera.net\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index 16cd940..b144885 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -377,7 +377,6 @@ _notmuch_database_log (notmuch_database_t *notmuch,\r
+ ...)\r
+ {\r
+ va_list va_args;\r
+- const char *message;\r
+ \r
+ va_start (va_args, format);\r
+ \r
+@@ -693,9 +692,9 @@ notmuch_database_create_verbose (const char *path,\r
+ goto DONE;\r
+ }\r
+ \r
+- status = notmuch_database_open (path,\r
+- NOTMUCH_DATABASE_MODE_READ_WRITE,\r
+- ¬much);\r
++ status = notmuch_database_open_verbose (path,\r
++ NOTMUCH_DATABASE_MODE_READ_WRITE,\r
++ ¬much, &message);\r
+ if (status)\r
+ goto DONE;\r
+ \r
+@@ -1101,13 +1100,18 @@ notmuch_database_compact (const char *path,\r
+ notmuch_database_t *notmuch = NULL;\r
+ struct stat statbuf;\r
+ notmuch_bool_t keep_backup;\r
++ char *message = NULL;\r
+ \r
+ local = talloc_new (NULL);\r
+ if (! local)\r
+ return NOTMUCH_STATUS_OUT_OF_MEMORY;\r
+ \r
+- ret = notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much);\r
++ ret = notmuch_database_open_verbose (path,\r
++ NOTMUCH_DATABASE_MODE_READ_WRITE,\r
++ ¬much,\r
++ &message);\r
+ if (ret) {\r
++ if (status_cb) status_cb (message, closure);\r
+ goto DONE;\r
+ }\r
+ \r
+diff --git a/lib/query.cc b/lib/query.cc\r
+index 2e20ab2..9ed420c 100644\r
+--- a/lib/query.cc\r
++++ b/lib/query.cc\r
+@@ -78,7 +78,7 @@ notmuch_query_create (notmuch_database_t *notmuch,\r
+ notmuch_query_t *query;\r
+ \r
+ if (_debug_query ())\r
+- _notmuch_database_log (notmuch, "Query string is:\n%s\n", query_string);\r
++ fprintf (stderr, "Query string is:\n%s\n", query_string);\r
+ \r
+ query = talloc (notmuch, notmuch_query_t);\r
+ if (unlikely (query == NULL))\r
+@@ -266,9 +266,9 @@ notmuch_query_search_messages (notmuch_query_t *query)\r
+ }\r
+ \r
+ if (_debug_query ()) {\r
+- _notmuch_database_log (notmuch, "Exclude query is:\n%s\n",\r
++ fprintf (stderr, "Exclude query is:\n%s\n",\r
+ exclude_query.get_description ().c_str ());\r
+- _notmuch_database_log (notmuch, "Final query is:\n%s\n",\r
++ fprintf (stderr, "Final query is:\n%s\n",\r
+ final_query.get_description ().c_str ());\r
+ }\r
+ \r
+@@ -549,9 +549,9 @@ notmuch_query_count_messages (notmuch_query_t *query)\r
+ enquire.set_docid_order(Xapian::Enquire::ASCENDING);\r
+ \r
+ if (_debug_query ()) {\r
+- _notmuch_database_log (notmuch, "Exclude query is:\n%s\n",\r
++ fprintf (stderr, "Exclude query is:\n%s\n",\r
+ exclude_query.get_description ().c_str ());\r
+- _notmuch_database_log (notmuch, "Final query is:\n%s\n",\r
++ fprintf (stderr, "Final query is:\n%s\n",\r
+ final_query.get_description ().c_str ());\r
+ }\r
+ \r
+\r
+ lib/database.cc | 14 +++++++++-----\r
+ lib/query.cc | 10 +++++-----\r
+ 2 files changed, 14 insertions(+), 10 deletions(-)\r
+\r