From: David Bremner Date: Sat, 14 Mar 2015 17:02:31 +0000 (+0100) Subject: [Patch v4 6/9] lib: add a log function with output to a string in notmuch_database_t X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=552cc617e92a1a94e16bc40533586ccf172d604a;p=notmuch-archives.git [Patch v4 6/9] lib: add a log function with output to a string in notmuch_database_t --- diff --git a/ab/c9517e2242f57c93ca8ac35e1385b7a2a2bdfe b/ab/c9517e2242f57c93ca8ac35e1385b7a2a2bdfe new file mode 100644 index 000000000..98b569664 --- /dev/null +++ b/ab/c9517e2242f57c93ca8ac35e1385b7a2a2bdfe @@ -0,0 +1,101 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id C59FA431FD6 + for ; Sat, 14 Mar 2015 10:04:19 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 2.438 +X-Spam-Level: ** +X-Spam-Status: No, score=2.438 tagged_above=-999 required=5 + tests=[DNS_FROM_AHBL_RHSBL=2.438] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id SOdswf5HBszG for ; + Sat, 14 Mar 2015 10:04:17 -0700 (PDT) +Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net + [87.98.215.224]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 9105B431FD7 + for ; Sat, 14 Mar 2015 10:04:16 -0700 (PDT) +Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim + 4.80) (envelope-from ) + id 1YWpTL-00026i-2v; Sat, 14 Mar 2015 17:03:35 +0000 +Received: (nullmailer pid 4991 invoked by uid 1000); Sat, 14 Mar 2015 + 17:02:41 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [Patch v4 6/9] lib: add a log function with output to a string in + notmuch_database_t +Date: Sat, 14 Mar 2015 18:02:31 +0100 +Message-Id: <1426352554-4383-7-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.1.4 +In-Reply-To: <1426352554-4383-1-git-send-email-david@tethera.net> +References: <1426352554-4383-1-git-send-email-david@tethera.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 14 Mar 2015 17:04:20 -0000 + +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 b/lib/database.cc +index 48a830f..0409128 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -377,6 +377,20 @@ log_to_string (char **str, + va_end (va_args); + } + ++void ++_notmuch_database_log (notmuch_database_t *notmuch, ++ const char *format, ++ ...) ++{ ++ va_list va_args; ++ ++ va_start (va_args, format); ++ ++ vlog_to_string (notmuch, ¬much->status_string, format, va_args); ++ ++ va_end (va_args); ++} ++ + static void + find_doc_ids_for_term (notmuch_database_t *notmuch, + const char *term, +diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h +index 8a1f2fa..7cb6fd4 100644 +--- a/lib/notmuch-private.h ++++ b/lib/notmuch-private.h +@@ -190,6 +190,10 @@ _notmuch_message_id_compressed (void *ctx, const char *message_id); + notmuch_status_t + _notmuch_database_ensure_writable (notmuch_database_t *notmuch); + ++void ++_notmuch_database_log (notmuch_database_t *notmuch, ++ const char *format, ...); ++ + const char * + _notmuch_database_relative_path (notmuch_database_t *notmuch, + const char *path); +-- +2.1.4 +