mirror of https://github.com/craigerl/aprsd.git
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.
This commit is contained in:
parent
5d3f42f411
commit
24bbea1d49
|
@ -45,11 +45,24 @@ def setup_logging(loglevel=None, quiet=False):
|
||||||
logging.root.handlers = [InterceptHandler()]
|
logging.root.handlers = [InterceptHandler()]
|
||||||
logging.root.setLevel(log_level)
|
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
|
# remove every other logger's handlers
|
||||||
# and propagate to root logger
|
# and propagate to root logger
|
||||||
for name in logging.root.manager.loggerDict.keys():
|
for name in logging.root.manager.loggerDict.keys():
|
||||||
logging.getLogger(name).handlers = []
|
logging.getLogger(name).handlers = []
|
||||||
if name in ["imapclient.imaplib", "imaplib", "imapclient", "imapclient.util"]:
|
if name in disable_list:
|
||||||
logging.getLogger(name).propagate = False
|
logging.getLogger(name).propagate = False
|
||||||
else:
|
else:
|
||||||
logging.getLogger(name).propagate = True
|
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:
|
if CONF.email_plugin.enabled and CONF.email_plugin.debug:
|
||||||
imaps = [
|
for name in imap_list:
|
||||||
"imapclient.imaplib", "imaplib", "imapclient",
|
|
||||||
"imapclient.util",
|
|
||||||
]
|
|
||||||
for name in imaps:
|
|
||||||
logging.getLogger(name).propagate = True
|
logging.getLogger(name).propagate = True
|
||||||
|
|
||||||
if CONF.admin.web_enabled:
|
if CONF.admin.web_enabled:
|
||||||
|
|
Loading…
Reference in New Issue