diff options
Diffstat (limited to '')
-rw-r--r-- | archivist/cli.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/archivist/cli.py b/archivist/cli.py index c72f947..0b8abe1 100644 --- a/archivist/cli.py +++ b/archivist/cli.py @@ -2,14 +2,16 @@ import click CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) +def enable_debug(): + import logging + logger = logging.getLogger('peewee') + logger.setLevel(logging.DEBUG) + logger.addHandler(logging.StreamHandler()) + @click.group(context_settings = CONTEXT_SETTINGS) @click.option('--debug', '-d', is_flag=True, default=False) def cli(debug): - if debug: - import logging - logger = logging.getLogger('peewee') - logger.setLevel(logging.DEBUG) - logger.addHandler(logging.StreamHandler()) + if debug: enable_debug() @cli.group() def db(): |