Fix logging so certain modules don't output unwanted debug messages
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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'],
|
||||
|
||||
Reference in New Issue
Block a user