1 Return-Path: <bremner@tesseract.cs.unb.ca>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 19B96429E2F
\r
6 for <notmuch@notmuchmail.org>; Fri, 26 Dec 2014 09:43:32 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id lzVi4lkXW0Vx for <notmuch@notmuchmail.org>;
\r
16 Fri, 26 Dec 2014 09:43:31 -0800 (PST)
\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])
\r
18 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 18FB0429E2E
\r
21 for <notmuch@notmuchmail.org>; Fri, 26 Dec 2014 09:43:31 -0800 (PST)
\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)
\r
23 (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
24 id 1Y4YvC-00060J-My; Fri, 26 Dec 2014 13:43:30 -0400
\r
25 Received: (nullmailer pid 21754 invoked by uid 1000); Fri, 26 Dec 2014
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: notmuch@notmuchmail.org
\r
29 Subject: [PATCH 1/4] lib: add passthrough logger function
\r
30 Date: Fri, 26 Dec 2014 18:42:38 +0100
\r
31 Message-Id: <1419615761-21581-2-git-send-email-david@tethera.net>
\r
32 X-Mailer: git-send-email 2.1.3
\r
33 In-Reply-To: <1419615761-21581-1-git-send-email-david@tethera.net>
\r
34 References: <1419615761-21581-1-git-send-email-david@tethera.net>
\r
35 X-BeenThere: notmuch@notmuchmail.org
\r
36 X-Mailman-Version: 2.1.13
\r
38 List-Id: "Use and development of the notmuch mail system."
\r
39 <notmuch.notmuchmail.org>
\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
41 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
43 List-Post: <mailto:notmuch@notmuchmail.org>
\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
47 X-List-Received-Date: Fri, 26 Dec 2014 17:43:32 -0000
\r
49 As a first step to eliminating all the fprintfs in the library, make a
\r
50 logger function that just calls fprintf. This is a bit more complex
\r
51 than needed, because we want to do something more interesting with the
\r
52 formatted string in the future.
\r
54 lib/database.cc | 19 +++++++++++++++++++
\r
55 lib/notmuch.h | 10 +++++++++-
\r
56 2 files changed, 28 insertions(+), 1 deletion(-)
\r
58 diff --git a/lib/database.cc b/lib/database.cc
\r
59 index 3601f9d..f3c62ee 100644
\r
60 --- a/lib/database.cc
\r
61 +++ b/lib/database.cc
\r
62 @@ -916,6 +916,25 @@ notmuch_database_open (const char *path,
\r
67 +notmuch_database_log (notmuch_database_t *notmuch,
\r
68 + const char *format,
\r
72 + const char *message;
\r
74 + va_start (va_args, format);
\r
76 + message = talloc_vasprintf (notmuch, format, va_args);
\r
78 + /* XXX do something more clever here */
\r
79 + fputs (message, stderr);
\r
81 + talloc_free ((char *)message);
\r
86 notmuch_database_close (notmuch_database_t *notmuch)
\r
88 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
89 index 220839b..c8c8124 100644
\r
92 @@ -279,7 +279,15 @@ notmuch_status_t
\r
93 notmuch_database_open (const char *path,
\r
94 notmuch_database_mode_t mode,
\r
95 notmuch_database_t **database);
\r
98 + * Log a message to where the database is configured to log it
\r
100 + * Initially this does notmuch interesting, since the output is not
\r
101 + * yet configurable.
\r
104 +notmuch_database_log (notmuch_database_t *notmuch,
\r
105 + const char *format, ...);
\r
107 * Commit changes and close the given notmuch database.
\r