Make '--debug -v' default for now

Change-Id: I022942b9a4346fe59f3cc9ddc75806fbc1a10bec
This commit is contained in:
Yuriy Taraday 2015-08-28 18:10:33 +03:00
parent e58f12389d
commit 730fc2c747
2 changed files with 13 additions and 6 deletions

View File

@ -20,6 +20,8 @@ from octane import log
class OctaneApp(app.App):
DEFAULT_VERBOSE_LEVEL = 2 # Enable DEBUG logging
def __init__(self, **kwargs):
super(OctaneApp, self).__init__(
description='Octane - upgrade your Fuel',
@ -28,14 +30,16 @@ class OctaneApp(app.App):
**kwargs
)
def build_option_parser(self, description, version, argparse_kwargs=None):
parser = super(OctaneApp, self).build_option_parser(
description, version, argparse_kwargs)
parser.set_defaults(debug=True)
return parser
def configure_logging(self):
super(OctaneApp, self).configure_logging()
if self.options.verbose_level > 1:
log.set_console_formatter(
fmt='%(asctime)s %(levelname)-8s %(name)-15s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
)
log.silence_iso8601()
log.set_console_formatter()
log.silence_iso8601()
def main(argv=None):

View File

@ -32,6 +32,9 @@ class ColorFormatter(logging.Formatter):
def set_console_formatter(**formatter_kwargs):
formatter_kwargs.setdefault(
'fmt', '%(asctime)s %(levelname)-8s %(name)-15s %(message)s')
formatter_kwargs.setdefault('datefmt', '%Y-%m-%d')
root_logger = logging.getLogger('')
for handler in root_logger.handlers:
if isinstance(handler, logging.StreamHandler):