Skip to content

Commit

Permalink
Setup logging for both commands
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-allan committed Jun 29, 2021
1 parent b3f5dfc commit 03385c3
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions isyntax2raw/cli/isyntax2raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@
from .. import WriteTiles


def setup_logging(debug):
level = logging.INFO
if debug:
level = logging.DEBUG
logging.basicConfig(
level=level,
format="%(asctime)s %(levelname)-7s [%(name)16s] "
"(%(thread)10s) %(message)s"
)


@click.group()
def cli():
pass
Expand Down Expand Up @@ -59,14 +70,7 @@ def write_tiles(
tile_width, tile_height, resolutions, max_workers, batch_size,
fill_color, nested, debug, input_path, output_path
):
level = logging.INFO
if debug:
level = logging.DEBUG
logging.basicConfig(
level=level,
format="%(asctime)s %(levelname)-7s [%(name)16s] "
"(%(thread)10s) %(message)s"
)
setup_logging(debug)
with WriteTiles(
tile_width, tile_height, resolutions, max_workers,
batch_size, fill_color, nested, input_path, output_path
Expand All @@ -85,6 +89,7 @@ def write_tiles(
@click.argument('input_path')
@click.argument('output_file')
def write_metadata(debug, input_path, output_file):
setup_logging(debug)
with WriteTiles(
None, None, None, None,
None, None, None, input_path, None
Expand Down

0 comments on commit 03385c3

Please sign in to comment.