Skip to content

Commit 29bcdd5

Browse files
committed
feat(logging): improve generator runtime logging readability
Use a structured log format with timestamps and module names, and add progress logs in the runner so generation stages and summary counts are easier to follow.
1 parent c1b45b1 commit 29bcdd5

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/kicad_generator/cli.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from .config import GeneratorOptions, GeneratorTargets
99
from .runner import run
1010

11+
LOGGER = logging.getLogger(__name__)
12+
1113

1214
def _is_workspace_root(path: Path) -> bool:
1315
"""Check whether the given path looks like the repository workspace root.
@@ -136,7 +138,8 @@ def configure_logging(verbosity: int) -> None:
136138

137139
logging.basicConfig(
138140
level=level,
139-
format="%(levelname)s: %(message)s",
141+
format="%(asctime)s | %(levelname)-8s | %(name)s | %(message)s",
142+
datefmt="%Y-%m-%d %H:%M:%S",
140143
)
141144

142145

src/kicad_generator/runner.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ def apply_variant_filter(series: Sequence[ChipSeries], allowed: Sequence[str]) -
3030

3131

3232
def run(options: GeneratorOptions) -> int:
33+
LOGGER.info("Starting generation with targets: footprints=%s symbols=%s", options.targets.footprints, options.targets.symbols)
34+
LOGGER.debug("Generation options: output_dir=%s schema_dir=%s", options.output_dir, options.schema_dir)
3335
try:
3436
repo = SiliconSchemaRepository(options.schema_dir)
3537
except FileNotFoundError as exc:
@@ -68,12 +70,14 @@ def run(options: GeneratorOptions) -> int:
6870
)
6971

7072
series = apply_variant_filter([*chips, *module_series], options.variant_filter)
73+
LOGGER.info("Loaded %d series after filters (schema=%d, modules=%d).", len(series), len(chips), len(module_series))
7174

7275
if not series:
7376
LOGGER.warning("No series matched the provided filters.")
7477
return 1
7578

7679
if options.targets.footprints:
80+
LOGGER.info("Generating footprints...")
7781
try:
7882
footprint_library = (
7983
FootprintLibrary.from_directory(options.footprint_data_dir)
@@ -103,13 +107,19 @@ def run(options: GeneratorOptions) -> int:
103107
library=footprint_library,
104108
module_library=module_library,
105109
)
110+
LOGGER.info(
111+
"Footprints generated: %d artifacts, %d missing definitions.",
112+
len(footprint_result.artifacts),
113+
len(footprint_result.missing),
114+
)
106115
else:
107116
footprint_result = load_footprint_manifest(
108117
output_dir=options.output_dir,
109118
namespace=options.footprint_namespace,
110119
)
111120

112121
if options.targets.symbols:
122+
LOGGER.info("Generating symbols...")
113123
repo_root = options.kicad_library_utils_root
114124
if not repo_root or not repo_root.exists():
115125
LOGGER.error(
@@ -124,6 +134,7 @@ def run(options: GeneratorOptions) -> int:
124134
library_utils_root=repo_root,
125135
)
126136
symbol_generator.generate(series=series, footprints=footprint_result)
137+
LOGGER.info("Symbols generated for %d series.", len(series))
127138

128139
LOGGER.info("Generation complete.")
129140
return 0

0 commit comments

Comments
 (0)