Fix logging so certain modules don't output unwanted debug messages

This commit is contained in:
skullY
2019-09-08 21:21:04 -07:00
parent a5c8efddb4
commit 1d622467e4
3 changed files with 9 additions and 7 deletions
+7 -4
View File
@@ -38,6 +38,9 @@ import argcomplete
import colorama
from appdirs import user_config_dir
# Disable logging until we can configure it how the user wants
logging.basicConfig(filename='/dev/null')
# Log Level Representations
EMOJI_LOGLEVELS = {
'CRITICAL': '{bg_red}{fg_white}¬_¬{style_reset_all}',
@@ -424,7 +427,7 @@ class MILC(object):
if 'arg_only' in kwargs and kwargs['arg_only']:
arg_name = self.get_argument_name(*args, **kwargs)
self.arg_only.append(arg_name)
del(kwargs['arg_only'])
del kwargs['arg_only']
if handler is self._entrypoint:
self.add_argument(*args, **kwargs)
@@ -513,7 +516,6 @@ class MILC(object):
if option not in self.config[section]:
self.config[section][option] = getattr(self.args, argument)
self.release_lock()
def save_config(self):
@@ -617,6 +619,7 @@ class MILC(object):
def subcommand(self, description, **kwargs):
"""Decorator to register a subcommand.
"""
def subcommand_function(handler):
return self.add_subcommand(handler, description, **kwargs)
@@ -626,8 +629,8 @@ class MILC(object):
"""Called by __enter__() to setup the logging configuration.
"""
if len(logging.root.handlers) != 0:
# This is not a design decision. This is what I'm doing for now until I can examine and think about this situation in more detail.
raise RuntimeError('MILC should be the only system installing root log handlers!')
# MILC is the only thing that should have root log handlers
logging.root.handlers = []
self.acquire_lock()
+1 -2
View File
@@ -16,7 +16,6 @@ from pkgutil import walk_packages
import milc
SUBCOMMAND_BLACKLIST = ['qmk.cli.subcommands']
milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}Ψ{style_reset_all}'
@@ -89,7 +88,7 @@ def main():
for count, arg in enumerate(sys.argv[1:]):
if arg and arg[0] != '-':
sys.argv[count+1] = subcommand = arg.replace('-', '_')
sys.argv[count + 1] = subcommand = arg.replace('-', '_')
subcommand = subcommand.replace('_', '.')
break
+1 -1
View File
@@ -10,7 +10,7 @@ if __name__ == "__main__":
name=metadata['dist-name'],
description='A program to help users work with QMK Firmware.',
entry_points={
'console_scripts': ['%s = %s' % l for l in setup_cfg['entry_points'].items()]
'console_scripts': ['%s = %s' % l for l in setup_cfg['entry_points'].items()],
},
license='MIT License',
url=metadata['home-page'],