Skip to content

Commit

Permalink
Merge pull request #179 from jpgill86/pyav-warnings
Browse files Browse the repository at this point in the history
Raise the default threshold for PyAV messages from warning to critical
  • Loading branch information
jpgill86 committed Jan 19, 2020
2 parents 7cf7015 + 83fa196 commit 87a61a9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions neurotic/gui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
logger = logging.getLogger(__name__)


# raise the threshold for PyAV messages printed to the console from
# warning to critical
logging.getLogger('libav').setLevel(logging.CRITICAL)


pq.mN = pq.UnitQuantity('millinewton', pq.N/1e3, symbol = 'mN'); # define millinewton


Expand Down
9 changes: 9 additions & 0 deletions neurotic/gui/standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,19 @@ def toggle_debug_logging(self, checked):
if checked:
logger.parent.setLevel(logging.DEBUG)
logger.debug('Debug messages enabled')

# lower the threshold for PyAV messages printed to the console from
# critical to warning
logging.getLogger('libav').setLevel(logging.WARNING)

else:
logger.debug('Disabling debug messages')
logger.parent.setLevel(default_log_level)

# raise the threshold for PyAV messages printed to the console from
# warning to critical
logging.getLogger('libav').setLevel(logging.CRITICAL)

def view_log_file(self):
"""
Open the log file in an editor.
Expand Down
5 changes: 5 additions & 0 deletions neurotic/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ def parse_args(argv):

if args.debug:
logger.parent.setLevel(logging.DEBUG)

# lower the threshold for PyAV messages printed to the console from
# critical to warning
logging.getLogger('libav').setLevel(logging.WARNING)

if not args.launch_example_notebook:
# show only if Jupyter won't be launched, since the setting will
# not carry over into the kernel started by Jupyter
Expand Down

0 comments on commit 87a61a9

Please sign in to comment.