From 0a55181562e931abf050124b600ce835dfce8f01 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Mon, 4 Feb 2019 20:26:44 +0900 Subject: [PATCH] addressbook: add logging statements to help troubleshoot problems --- alot/addressbook/external.py | 4 ++++ alot/helper.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/alot/addressbook/external.py b/alot/addressbook/external.py index 93e767841..eea70cbca 100644 --- a/alot/addressbook/external.py +++ b/alot/addressbook/external.py @@ -6,6 +6,7 @@ from ..helper import call_cmd from ..helper import split_commandstring from . import AddressBook, AddressbookError +import logging class ExternalAddressbook(AddressBook): @@ -59,9 +60,11 @@ def _call_and_parse(self, commandline): raise AddressbookError(msg) if not resultstring: + logging.debug("No contacts in address book (empty string)") return [] lines = resultstring.splitlines() res = [] + logging.debug("Apply %s on %d results" % (self.regex, len(lines))) for l in lines: m = re.match(self.regex, l, self.reflags) if m: @@ -70,4 +73,5 @@ def _call_and_parse(self, commandline): email = info['email'].strip() name = info['name'] res.append((name, email)) + logging.debug("New match name=%s mail=%s" % (name, email)) return res diff --git a/alot/helper.py b/alot/helper.py index 9992e6c85..94ea108c4 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -276,6 +276,8 @@ def call_cmd(cmdlist, stdin=None): if isinstance(stdin, str): stdin = stdin.encode(termenc) try: + + logging.debug("Calling %s" % cmdlist) proc = subprocess.Popen( cmdlist, stdout=subprocess.PIPE,