Merge pull request #271 from lbryio/log-lbryum-on-verbose

enable lbryum info logging when verbose
This commit is contained in:
Job Evers‐Meltzer 2016-11-15 08:47:51 -06:00 committed by GitHub
commit 5b7f80487f

View file

@ -171,13 +171,14 @@ def convert_verbose(verbose):
should be at the info level. should be at the info level.
if --verbose is provided, but not followed by any arguments, then if --verbose is provided, but not followed by any arguments, then
args.verbose = [] and debug logging should be enabled for all of lbrynet args.verbose = [] and debug logging should be enabled for all of lbrynet
along with info logging on lbryum.
if --verbose is provided and followed by arguments, those arguments if --verbose is provided and followed by arguments, those arguments
will be in a list will be in a list
""" """
if verbose is None: if verbose is None:
return [] return []
if verbose == []: if verbose == []:
return ['lbrynet'] return ['lbrynet', 'lbryum']
return verbose return verbose
@ -204,6 +205,13 @@ def configure_logging(file_name, console, verbose=None):
# allow info. # allow info.
level = 'DEBUG' if verbose else 'INFO' level = 'DEBUG' if verbose else 'INFO'
handler = configure_console(level=level) handler = configure_console(level=level)
if 'lbryum' in verbose:
# TODO: this enables lbryum logging on the other handlers
# too which isn't consistent with how verbose logging
# happens with other loggers. Should change the configuration
# so that its only logging at the INFO level for the console.
logging.getLogger('lbryum').setLevel(logging.INFO)
verbose.remove('lbryum')
if verbose: if verbose:
handler.addFilter(LoggerNameFilter(verbose)) handler.addFilter(LoggerNameFilter(verbose))