Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/cli/__init__.py
# Copyright (C) 2017-2019 The Software Heritage developers | # Copyright (C) 2017-2019 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import click | import click | ||||
import logging | import logging | ||||
from swh.core.cli import CONTEXT_SETTINGS | from swh.core.cli import CONTEXT_SETTINGS, log_level_option | ||||
logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||
@click.group(context_settings=CONTEXT_SETTINGS) | @click.group(context_settings=CONTEXT_SETTINGS) | ||||
@log_level_option | |||||
@click.pass_context | @click.pass_context | ||||
def deposit(ctx): | def deposit(ctx, log_level): | ||||
"""Deposit main command | """Deposit main command | ||||
""" | """ | ||||
ctx.ensure_object(dict) | |||||
log_level = ctx.obj.get('log_level', logging.INFO) | |||||
logger.setLevel(log_level) | logger.setLevel(log_level) | ||||
def main(): | def main(): | ||||
logging.basicConfig() | logging.basicConfig() | ||||
return deposit(auto_envvar_prefix='SWH_DEPOSIT') | return deposit(auto_envvar_prefix='SWH_DEPOSIT') | ||||
# These import statements MUST be executed after defining the 'deposit' group | # These import statements MUST be executed after defining the 'deposit' group | ||||
Show All 10 Lines |