From: David Bremner Date: Sun, 28 Dec 2014 17:33:47 +0000 (+0100) Subject: [Patch v3 3/6] 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=0cca131ca66c139903a7cbbca27c93a73d140203;p=notmuch-archives.git [Patch v3 3/6] lib: add a log function with output to a string in notmuch_database_t --- diff --git a/c0/a580accd5952e4dfbb9b1bd468be0d0a8ddba9 b/c0/a580accd5952e4dfbb9b1bd468be0d0a8ddba9 new file mode 100644 index 000000000..957de7c31 --- /dev/null +++ b/c0/a580accd5952e4dfbb9b1bd468be0d0a8ddba9 @@ -0,0 +1,100 @@ +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 BFF3F429E40 + for ; Sun, 28 Dec 2014 09:38:39 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 2bU3Xt2WYUfc for ; + Sun, 28 Dec 2014 09:38:37 -0800 (PST) +Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id A7945429E41 + for ; Sun, 28 Dec 2014 09:38:20 -0800 (PST) +Received: from remotemail by yantan.tethera.net with local (Exim 4.80) + (envelope-from ) + id 1Y5HnI-0002hR-7p; Sun, 28 Dec 2014 13:38:20 -0400 +Received: (nullmailer pid 11498 invoked by uid 1000); Sun, 28 Dec 2014 + 17:37:40 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [Patch v3 3/6] lib: add a log function with output to a string in + notmuch_database_t +Date: Sun, 28 Dec 2014 18:33:47 +0100 +Message-Id: <1419788030-10567-4-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.1.3 +In-Reply-To: <1419788030-10567-1-git-send-email-david@tethera.net> +References: <1419788030-10567-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: Sun, 28 Dec 2014 17:38:40 -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 18db902..9af1a47 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -371,6 +371,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 012ad25..7c6cfc0 100644 +--- a/lib/notmuch-private.h ++++ b/lib/notmuch-private.h +@@ -191,6 +191,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.3 +