From 24bbea1d499644d9d4bd7aab62f05b5802b2867e Mon Sep 17 00:00:00 2001 From: Hemna Date: Thu, 7 Mar 2024 09:46:36 -0500 Subject: [PATCH] Disable debug logs for aprslib This patch adds a disable of propogating the debug logs from the aprslib parsing. We don't really need to see this in our aprsd services. --- aprsd/log/log.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/aprsd/log/log.py b/aprsd/log/log.py index f21a148..15ded90 100644 --- a/aprsd/log/log.py +++ b/aprsd/log/log.py @@ -45,11 +45,24 @@ def setup_logging(loglevel=None, quiet=False): logging.root.handlers = [InterceptHandler()] logging.root.setLevel(log_level) + imap_list = [ + "imapclient.imaplib", "imaplib", "imapclient", + "imapclient.util", + ] + aprslib_list = [ + "aprslib", + "aprslib.parsing", + "aprslib.exceptions", + ] + + # We don't really want to see the aprslib parsing debug output. + disable_list = imap_list + aprslib_list + # remove every other logger's handlers # and propagate to root logger for name in logging.root.manager.loggerDict.keys(): logging.getLogger(name).handlers = [] - if name in ["imapclient.imaplib", "imaplib", "imapclient", "imapclient.util"]: + if name in disable_list: logging.getLogger(name).propagate = False else: logging.getLogger(name).propagate = True @@ -69,11 +82,7 @@ def setup_logging(loglevel=None, quiet=False): ) if CONF.email_plugin.enabled and CONF.email_plugin.debug: - imaps = [ - "imapclient.imaplib", "imaplib", "imapclient", - "imapclient.util", - ] - for name in imaps: + for name in imap_list: logging.getLogger(name).propagate = True if CONF.admin.web_enabled: