Skip to content

Commit

Permalink
Prevent Sphinx from dumping all level=INFO logging output to stdout.
Browse files Browse the repository at this point in the history
See #1036 for more information.
  • Loading branch information
zachriggle committed Sep 22, 2017
1 parent ebbe917 commit 601b1f2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,23 @@
'sphinxcontrib.napoleon'
]

# Disable "info" logging directly to stdout by Sphinx
import logging
import sphinx.util.logging

class SphinxPwnlibFilter(logging.Filter):
def filter(self, record):
if record.name.startswith('pwn'):
return False
return True

log_filter = SphinxPwnlibFilter()

for i, handler in enumerate(logging.root.handlers):
if isinstance(handler, sphinx.util.logging.NewLineStreamHandler):
print("Filtering Sphinx handler", handler)
handler.addFilter(log_filter)

# Napoleon settings
napoleon_use_ivar = True
napoleon_use_rtype = False
Expand Down

0 comments on commit 601b1f2

Please sign in to comment.