unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* libnotmuch logging overhaul v3
@ 2014-12-28 17:33 David Bremner
  2014-12-28 17:33 ` [Patch v3 1/6] lib: add "verbose" versions of notmuch_database_{open,create} David Bremner
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: David Bremner @ 2014-12-28 17:33 UTC (permalink / raw)
  To: notmuch

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(-)

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-12-28 17:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [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

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).