From 161cbab8a7d9a06db4009c379b003285167bed25 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 5 Jul 2026 10:36:05 +0200 Subject: [PATCH] refine logging --- scripts/capture_csv.py | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/scripts/capture_csv.py b/scripts/capture_csv.py index 7fce842..b547990 100755 --- a/scripts/capture_csv.py +++ b/scripts/capture_csv.py @@ -48,6 +48,8 @@ def enable_dryer_logging(ser, retries: int = 3) -> None: return if line.startswith("csv,"): return + if line: + print(line) time.sleep(0.5 * (attempt + 1)) print("WARN: did not see 'OK csv logging on' — continuing anyway", file=sys.stderr) @@ -78,12 +80,6 @@ def main() -> int: default=True, help="Send 'log on' to the dryer after connect (default: on)", ) - parser.add_argument( - "-v", - "--verbose", - action="store_true", - help="Echo captured CSV rows to stdout; other serial lines to stderr", - ) args = parser.parse_args() port = args.port @@ -131,32 +127,24 @@ def main() -> int: line = raw.decode("utf-8", errors="replace").strip() if not line.startswith("csv_hdr,") and not line.startswith("csv,"): - if args.verbose and line: - print(line, file=sys.stderr) + if line: + print(line) continue if line.startswith("csv_hdr,"): device_header = line[len("csv_hdr,") :] - row = "wall_time," + device_header - fh.write(row + "\n") + fh.write("wall_time," + device_header + "\n") header_written = True fh.flush() - if args.verbose: - print(row) continue if not header_written: fh.write(FALLBACK_HEADER + "\n") header_written = True - if args.verbose: - print(FALLBACK_HEADER) wall_time = datetime.now(timezone.utc).isoformat(timespec="seconds") - row = wall_time + "," + line[len("csv,") :] - fh.write(row + "\n") + fh.write(wall_time + "," + line[len("csv,") :] + "\n") fh.flush() - if args.verbose: - print(row) if __name__ == "__main__":