Skip to content

Commit

Permalink
Modify logger initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
thombashi committed Sep 9, 2020
1 parent 37f0377 commit d28ed2a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions cli_project_name/__main_click__.py
Expand Up @@ -44,6 +44,8 @@ def cmd(ctx, log_level: str, verbosity_level: int):
ctx.obj[Context.LOG_LEVEL] = LogLevel.INFO if log_level is None else log_level
ctx.obj[Context.VERBOSITY_LEVEL] = verbosity_level

initialize_logger(name="{:s} subcmd1".format(MODULE_NAME), log_level=ctx.obj[Context.LOG_LEVEL])


@cmd.command(epilog=COMMAND_EPILOG)
@click.pass_context
Expand All @@ -54,11 +56,8 @@ def subcmd1(ctx, filepaths, is_flag):
subcmd1 help
"""

log_level = ctx.obj[Context.LOG_LEVEL]
verbosity_level = ctx.obj[Context.VERBOSITY_LEVEL]

initialize_logger(name="{:s} subcmd1".format(MODULE_NAME), log_level=ctx.obj[Context.LOG_LEVEL])

for filepath in filepaths:
click.echo(filepath)

Expand All @@ -71,11 +70,8 @@ def subcmd2(ctx, choice):
subcmd2 help
"""

log_level = ctx.obj[Context.LOG_LEVEL]
verbosity_level = ctx.obj[Context.VERBOSITY_LEVEL]

initialize_logger(name="{:s} subcmd2".format(MODULE_NAME), log_level=ctx.obj[Context.LOG_LEVEL])

click.echo(choice)


Expand Down

0 comments on commit d28ed2a

Please sign in to comment.