From 54c47b3daa238b9a8e06d1c7825453b65658734f Mon Sep 17 00:00:00 2001 From: Zach Riggle Date: Thu, 21 Sep 2017 17:50:53 -0700 Subject: [PATCH] Try to cut down on the crazy verbosity of logging (#1036) * Prevent Sphinx from dumping all level=INFO logging output to stdout. See Gallopsled/pwntools#1036 for more information. * Filter out Paramiko logs too, apply filter to all root handlers during testing * Remove unused import --- docs/source/conf.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index 323fd6f70..387fbe08c 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -44,6 +44,23 @@ 'sphinxcontrib.napoleon' ] +# Disable "info" logging directly to stdout by Sphinx +import logging + +class SphinxPwnlibFilter(logging.Filter): + def filter(self, record): + if record.name.startswith('pwn'): + return False + if record.name.startswith('paramiko'): + return False + return True + +log_filter = SphinxPwnlibFilter() + +for i, handler in enumerate(logging.root.handlers): + print("Filtering Sphinx handler", handler) + handler.addFilter(log_filter) + # Napoleon settings napoleon_use_ivar = True napoleon_use_rtype = False