diff --git a/swh/scheduler/cli/__init__.py b/swh/scheduler/cli/__init__.py --- a/swh/scheduler/cli/__init__.py +++ b/swh/scheduler/cli/__init__.py @@ -6,11 +6,11 @@ import click import logging - -CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) +from swh.core.cli import CONTEXT_SETTINGS, log_level_option @click.group(context_settings=CONTEXT_SETTINGS) +@log_level_option @click.option('--config-file', '-C', default=None, type=click.Path(exists=True, dir_okay=False,), help="Configuration file.") @@ -21,7 +21,7 @@ @click.option('--no-stdout', is_flag=True, default=False, help="Do NOT output logs on the console") @click.pass_context -def cli(ctx, config_file, database, url, no_stdout): +def cli(ctx, log_level, config_file, database, url, no_stdout): """Scheduler CLI interface. Default to use the the local scheduler instance (plugged to the @@ -33,7 +33,7 @@ from swh.scheduler import get_scheduler, DEFAULT_CONFIG setup_log_handler( - loglevel=ctx.obj['log_level'], colorize=False, + loglevel=log_level, colorize=False, format='[%(levelname)s] %(name)s -- %(message)s', log_console=not no_stdout)