aboutsummaryrefslogtreecommitdiff
path: root/lib/query.cc
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2016-07-15 07:25:41 -0300
committerDavid Bremner <david@tethera.net>2016-08-09 09:34:11 +0900
commit293186d6c6b1c4d158413de5412e6b4345e94970 (patch)
tree483440c0ef66a669f559f2fe30273a965122f1f2 /lib/query.cc
parentf45fa5bdd397d52473f7092f7ae3e2ffb9b7aee5 (diff)
lib: provide _notmuch_database_log_append
_notmuch_database_log clears the log buffer each time. Rather than introducing more complicated semantics about for this function, provide a second function that does not clear the buffer. This is mainly a convenience function for callers constructing complex or multi-line log messages. The changes to query.cc are to make sure that the common code path of the new function is tested.
Diffstat (limited to 'lib/query.cc')
-rw-r--r--lib/query.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/query.cc b/lib/query.cc
index 7eb73a13..53efd4e1 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -299,9 +299,10 @@ _notmuch_query_search_documents (notmuch_query_t *query,
} catch (const Xapian::Error &error) {
_notmuch_database_log (notmuch,
- "A Xapian exception occurred performing query: %s\n"
+ "A Xapian exception occurred performing query: %s\n",
+ error.get_msg().c_str());
+ _notmuch_database_log_append (notmuch,
"Query string was: %s\n",
- error.get_msg().c_str(),
query->query_string);
notmuch->exception_reported = TRUE;
@@ -613,10 +614,11 @@ _notmuch_query_count_documents (notmuch_query_t *query, const char *type, unsign
} catch (const Xapian::Error &error) {
_notmuch_database_log (notmuch,
- "A Xapian exception occurred performing query: %s\n"
- "Query string was: %s\n",
- error.get_msg().c_str(),
- query->query_string);
+ "A Xapian exception occurred performing query: %s\n",
+ error.get_msg().c_str());
+ _notmuch_database_log_append (notmuch,
+ "Query string was: %s\n",
+ query->query_string);
return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
}