[Patch v4 6/9] lib: add a log function with output to a string in notmuch_database_t

2015-03-14 Thread David Bremner
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

libnotmuch logging overhaul v4

2015-03-14 Thread David Bremner
Obsoletes id:1419788030-10567-1-git-send-email-da...@tethera.net The bad news is it is 3 patches longer; the good news is that I think those patches are just testing and make sense whether we do the rest or not. The first 4 patches together now have the have the effect adding a quiet

[Patch v4 8/9] lib: replace almost all fprintfs in library with _n_d_log

2015-03-14 Thread David Bremner
This is not supposed to change any functionality from an end user point of view. Note that it will eliminate some output to stderr. The query debugging output is left as is; it doesn't really fit with the current primitive logging model. The remaining bad fprintf will need an internal API change.

[Patch v4 5/9] lib/database: add field for last error string

2015-03-14 Thread David Bremner
The idea is to have a logging function setting this string instead of printing to stderr. --- lib/database-private.h | 4 lib/database.cc| 7 +++ lib/notmuch.h | 7 +++ 3 files changed, 18 insertions(+) diff --git a/lib/database-private.h b/lib/database-private.h

[Patch v4 3/9] test: add error reporting tests for lib/database.cc

2015-03-14 Thread David Bremner
Unfortunately quite a few of the error handling paths here require more sophisticated tests using e.g. gdb. --- test/T560-lib-error.sh | 91 ++ 1 file changed, 91 insertions(+) create mode 100755 test/T560-lib-error.sh diff --git

[Patch v4 1/9] test: Add two tests for error output from notmuch_database_open

2015-03-14 Thread David Bremner
This is arguably testing the same thing twice, but in the brave new future where we don't use printf anymore, each subcommand will be responsible for handling the output on it's own. --- test/T050-new.sh | 7 +++ test/T150-tagging.sh | 6 ++ 2 files changed, 13 insertions(+) diff

[Patch v4 7/9] lib: add private function to extract the database for a message.

2015-03-14 Thread David Bremner
This is needed by logging in functions outside message.cc that take only a notmuch_message_t object. --- lib/message.cc| 6 ++ lib/notmuch-private.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/lib/message.cc b/lib/message.cc index 956a70a..b84e5e1 100644 ---

[Patch v4 4/9] lib: add verbose versions of notmuch_database_{open,create}

2015-03-14 Thread David Bremner
The compatibility wrapper ensures that clients calling notmuch_database_open will receive consistent output for now. The stdargs based infrastucture will be used in following commits for a more general logging mechanism. The changes to notmuch-{new,search} and test/symbol-test are just to make

libnotmuch logging overhaul v4

2015-03-14 Thread David Bremner
Obsoletes id:1419788030-10567-1-git-send-email-david at tethera.net The bad news is it is 3 patches longer; the good news is that I think those patches are just testing and make sense whether we do the rest or not. The first 4 patches together now have the have the effect adding a

[Patch v4 8/9] lib: replace almost all fprintfs in library with _n_d_log

2015-03-14 Thread David Bremner
This is not supposed to change any functionality from an end user point of view. Note that it will eliminate some output to stderr. The query debugging output is left as is; it doesn't really fit with the current primitive logging model. The remaining "bad" fprintf will need an internal API

[Patch v4 2/9] test: add support for compiling and running C snippets

2015-03-14 Thread David Bremner
This is to limit the copy-pasta involved in running C tests. I decided to keep things simple and not try to provide an actual C skeleton. The setting of LD_LIBRARY_PATH is to force using the built libnotmuch rather than any potential system one. --- test/README | 5 + test/test-lib.sh

[Patch v4 6/9] lib: add a log function with output to a string in notmuch_database_t

2015-03-14 Thread David Bremner
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

[Patch v4 3/9] test: add error reporting tests for lib/database.cc

2015-03-14 Thread David Bremner
Unfortunately quite a few of the error handling paths here require more sophisticated tests using e.g. gdb. --- test/T560-lib-error.sh | 91 ++ 1 file changed, 91 insertions(+) create mode 100755 test/T560-lib-error.sh diff --git

[Patch v4 7/9] lib: add private function to extract the database for a message.

2015-03-14 Thread David Bremner
This is needed by logging in functions outside message.cc that take only a notmuch_message_t object. --- lib/message.cc| 6 ++ lib/notmuch-private.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/lib/message.cc b/lib/message.cc index 956a70a..b84e5e1 100644 ---

[Patch v4 9/9] lib: eliminate fprintf from _notmuch_message_file_open

2015-03-14 Thread David Bremner
You may wonder why _notmuch_message_file_open_ctx has two parameters. This is because we need sometime to use a ctx which is a notmuch_message_t. While we could get the database from this, there is no easy way in C to tell type we are getting. The remaining fprintf is removed by Jani's series

[Patch v4 5/9] lib/database: add field for last error string

2015-03-14 Thread David Bremner
The idea is to have a logging function setting this string instead of printing to stderr. --- lib/database-private.h | 4 lib/database.cc| 7 +++ lib/notmuch.h | 7 +++ 3 files changed, 18 insertions(+) diff --git a/lib/database-private.h b/lib/database-private.h

[Patch v4 4/9] lib: add "verbose" versions of notmuch_database_{open,create}

2015-03-14 Thread David Bremner
The compatibility wrapper ensures that clients calling notmuch_database_open will receive consistent output for now. The stdargs based infrastucture will be used in following commits for a more general logging mechanism. The changes to notmuch-{new,search} and test/symbol-test are just to make

[Patch v4 1/9] test: Add two tests for error output from notmuch_database_open

2015-03-14 Thread David Bremner
This is arguably testing the same thing twice, but in the brave new future where we don't use printf anymore, each subcommand will be responsible for handling the output on it's own. --- test/T050-new.sh | 7 +++ test/T150-tagging.sh | 6 ++ 2 files changed, 13 insertions(+) diff