Skip to content

Commit 03385c3

Browse files
committed
Setup logging for both commands
1 parent b3f5dfc commit 03385c3

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

isyntax2raw/cli/isyntax2raw.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@
1313
from .. import WriteTiles
1414

1515

16+
def setup_logging(debug):
17+
level = logging.INFO
18+
if debug:
19+
level = logging.DEBUG
20+
logging.basicConfig(
21+
level=level,
22+
format="%(asctime)s %(levelname)-7s [%(name)16s] "
23+
"(%(thread)10s) %(message)s"
24+
)
25+
26+
1627
@click.group()
1728
def cli():
1829
pass
@@ -59,14 +70,7 @@ def write_tiles(
5970
tile_width, tile_height, resolutions, max_workers, batch_size,
6071
fill_color, nested, debug, input_path, output_path
6172
):
62-
level = logging.INFO
63-
if debug:
64-
level = logging.DEBUG
65-
logging.basicConfig(
66-
level=level,
67-
format="%(asctime)s %(levelname)-7s [%(name)16s] "
68-
"(%(thread)10s) %(message)s"
69-
)
73+
setup_logging(debug)
7074
with WriteTiles(
7175
tile_width, tile_height, resolutions, max_workers,
7276
batch_size, fill_color, nested, input_path, output_path
@@ -85,6 +89,7 @@ def write_tiles(
8589
@click.argument('input_path')
8690
@click.argument('output_file')
8791
def write_metadata(debug, input_path, output_file):
92+
setup_logging(debug)
8893
with WriteTiles(
8994
None, None, None, None,
9095
None, None, None, input_path, None

0 commit comments

Comments
 (0)