Replace 27 debug print() statements with proper logging #3

Closed
opened 2026-03-19 17:29:52 +00:00 by llabeyrie · 0 comments
Owner

Description

prompt_to_card_pipeline.py contains 27 unconditional print() statements with informal debug messages scattered throughout the file:

"module successfully charged"
"model charging 1" / "model charged 1"
"model charge 2" / "model charged 2"
"getting module" / "module got"
"building pipeline" / "pipeline build"
"will start result" / "result is done"
"json parsed with success"
"main get clean text" / "main got clean text"
...

Affected lines: 40, 45, 47, 57, 78, 91, 107, 116, 121, 167, 169, 174, 178, 188, 190, 208, 210, 299, 302, 305, 308, 316, 317, 326, 334

Problems

  • Pollutes stdout, which is also used to parse structured output (JSON, image paths)
  • Breaks --print-json and --json-only output when piped or parsed by app.py
  • Informal messages (mix of English/French) look unprofessional
  • No way to enable/disable them (no log level control)

Fix

Replace all print() calls with Python's logging module:

import logging
logger = logging.getLogger(__name__)

logger.debug("Module loaded from %s", module_path)
## Description `prompt_to_card_pipeline.py` contains **27 unconditional `print()` statements** with informal debug messages scattered throughout the file: ``` "module successfully charged" "model charging 1" / "model charged 1" "model charge 2" / "model charged 2" "getting module" / "module got" "building pipeline" / "pipeline build" "will start result" / "result is done" "json parsed with success" "main get clean text" / "main got clean text" ... ``` **Affected lines:** 40, 45, 47, 57, 78, 91, 107, 116, 121, 167, 169, 174, 178, 188, 190, 208, 210, 299, 302, 305, 308, 316, 317, 326, 334 ### Problems - Pollutes stdout, which is also used to parse structured output (JSON, image paths) - Breaks `--print-json` and `--json-only` output when piped or parsed by `app.py` - Informal messages (mix of English/French) look unprofessional - No way to enable/disable them (no log level control) ### Fix Replace all `print()` calls with Python's `logging` module: ```python import logging logger = logging.getLogger(__name__) logger.debug("Module loaded from %s", module_path) ```
llabeyrie added the code-qualitypriority: high labels 2026-03-19 17:31:38 +00:00
Sign in to join this conversation.