Skip to content

Commit 09c9ea7

Browse files
Essozclaude
andcommitted
fix: prefix all TrainCheck log output with [TrainCheck]
Update logging format strings in all three CLI entry points so every log message is visually identifiable as coming from TrainCheck, not the user's training script. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3c820a3 commit 09c9ea7

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

traincheck/checker.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@ def main():
263263
# INFO logs stay in the log file only.
264264
stream_handler = logging.StreamHandler()
265265
stream_handler.setLevel(logging.WARNING)
266+
stream_handler.setFormatter(
267+
logging.Formatter("[TrainCheck] %(levelname)s: %(message)s")
268+
)
266269
logger.addHandler(stream_handler)
267270

268271
results_by_trace: list[tuple[str, list[CheckerResult]]] = []

traincheck/collect_trace.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,12 @@ def main():
432432
args.warm_up_steps = config.INSTRUMENTATION_POLICY["warm_up"]
433433

434434
# set up logging
435+
_log_fmt = "[TrainCheck] %(levelname)s: %(message)s"
435436
if args.debug_mode:
436-
logging.basicConfig(level=logging.DEBUG)
437+
logging.basicConfig(level=logging.DEBUG, format=_log_fmt)
437438
os.environ["TRAINCHECK_DEBUG"] = "1"
438439
else:
439-
logging.basicConfig(level=logging.INFO)
440+
logging.basicConfig(level=logging.INFO, format=_log_fmt)
440441

441442
logger = logging.getLogger(__name__)
442443

traincheck/infer_engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def main():
285285
logging.basicConfig(
286286
filename=f'traincheck_infer_engine_{datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")}_{pid}.log',
287287
level=log_level,
288-
format="%(asctime)s - %(levelname)s - [%(filename)s:%(lineno)s - %(funcName)20s()] - %(message)s",
288+
format="%(asctime)s - [TrainCheck] %(levelname)s - [%(filename)s:%(lineno)s - %(funcName)20s()] - %(message)s",
289289
)
290290

291291
disabled_relations: list[Relation] = []

0 commit comments

Comments
 (0)