Skip to content

fix(fluidics): keep fluidics DEBUG in run.log; the rest of Squid's logging at INFO and above - #866

Open
hongquanli wants to merge 2 commits into
masterfrom
fix/run-log-info-level
Open

hongquanli wants to merge 2 commits into
masterfrom
fix/run-log-info-level

Conversation

@hongquanli

@hongquanli hongquanli commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What fails

A 38 h fluidics protocol run wrote a 905 MB run.log (6.45 M lines). The same lines also went to main_hcs.log and to each round's acquisition.log, about 2.7 GB of logs for one run.

run.log's handler sits on the squid root logger at DEBUG, so it copied every DEBUG line from the rest of Squid: 42 % of run.log was Timer DEBUG and 35 % Microcontroller DEBUG.

Fix

run.log keeps every fluidics record, DEBUG included, and the rest of Squid's logging at INFO and above.

  • A filter on run.log's handler passes a record when it is INFO or above, or when its logger is a fluidics logger: the library's (fluidics.*, XCaliburD; the logging bridge forwards their records under these names) or Squid's fluidics packages. So the library's DEBUG detail (valve routing, sequence contents) stays in run.log, and the Timer and MCU DEBUG lines do not.
  • The fluidics logger names now live in one place, control/core/fluidics_protocol/logger_names.py. run.log, the GUI's Fluidics Log pane and the library logging bridge all use it; the pane and the bridge each had a copy before.
  • squid.logging.add_file_handler takes an optional record_filter, attached before the handler goes on the logger, so the filter also applies to the file's first record.
  • main_hcs.log and acquisition.log are unchanged (DEBUG, everything).
  • The run-folder docs note what run.log keeps.

Test

test_run_log_keeps_fluidics_debug_and_the_rest_of_squid_at_info_and_above runs a runner with the fake ports. Mid-run it logs DEBUG and INFO from a non-fluidics squid logger, DEBUG from a Squid fluidics logger, and a library DEBUG record handed to the squid root logger the way the bridge does. run.log has the INFO line and both fluidics DEBUG lines, and not the other DEBUG line.

Local results, PyQt5 and PyQt6, with the fluidics library at the pinned commit on PYTHONPATH: the fluidics protocol, fluidics widget, fluidics system and squid logging tests, 131 passed. test_log_and_sensors.py::test_a_tall_window_shows_the_whole_instrument_block fails locally on master too (macOS window size); CI runs it under Xvfb.

Not verified

  • Not run on a rig, so run.log's size on a real run is not measured. The Timer and MCU lines were 77 % of the old run.log, so it should be at most about a quarter of the old size; how much of the rest is fluidics DEBUG is not measured.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Run-specific logs now include fluidics messages at DEBUG level and other Squid messages at INFO level and above. These messages are also available in the main log.
  • Documentation
    • Clarified the log levels and message types included in run.log and main_hcs.log, so readers can better understand where to find protocol and fluidics activity.

…in main_hcs.log

run.log's handler sits on the squid root logger and took DEBUG, so every
DEBUG line from the rest of Squid (Timer, MCU) went into it for the whole
run, on top of the same lines in main_hcs.log and each round's
acquisition.log. Attach it at INFO: run.log is the run's readable record,
and the DEBUG detail is still in the other two logs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change centralizes fluidics logger selection and adds record filtering to run log handlers. Run logs include INFO-and-higher records and DEBUG records from registered fluidics loggers. Documentation and a test describe and verify the run log contents.

Changes: Run log output

Layer / File(s) Summary
Centralize fluidics logger selection
software/control/core/fluidics_protocol/logger_names.py, software/control/fluidics_system.py, software/control/widgets_fluidics/log_view.py
A shared module defines fluidics logger names and returns the corresponding loggers. The fluidics system and log view use these shared definitions.
Configure and verify run log filtering
software/squid/logging.py, software/control/core/fluidics_protocol/runner.py, software/docs/fluidics-protocol.md, software/tests/control/core/fluidics_protocol/test_runner.py
add_file_handler accepts an optional record filter. The run handler includes INFO-and-higher records and DEBUG records from registered fluidics loggers. The documentation describes the run log contents, and the test checks included and excluded records.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: alpaca233

Merge Risk: Minimal · up to 556b9

This change narrows run.log to INFO and above plus fluidics DEBUG, which reduces file size. The GUI Log tab is unchanged. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title is a conventional commit that names the main change: fluidics DEBUG records are kept in run.log while other Squid logging is limited to INFO and above. The raw summary confirms the runner.py…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title is a conventional commit that names the main change: fluidics DEBUG records are kept in run.log while other Squid logging is limited to INFO and above. The raw summary confirms the runner.py filter, the logger_names.py consolidation, and the record_filter option in add_file_handler. The title is specific and matches the changeset. It is slightly long (92 characters), but that does not make it unclear.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 87eda483-6852-413f-a260-1dbfcafdcd75
Commits

Reviewing files that changed from the base of the PR and between c53b8c4 and 556b9a5.

Files selected for processing: 7

  • software/control/core/fluidics_protocol/logger_names.py
  • software/control/core/fluidics_protocol/runner.py
  • software/control/fluidics_system.py
  • software/control/widgets_fluidics/log_view.py
  • software/docs/fluidics-protocol.md
  • software/squid/logging.py
  • software/tests/control/core/fluidics_protocol/test_runner.py
Files skipped from review as they are similar to previous changes: 1

  • software/docs/fluidics-protocol.md

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.

…s at INFO

run.log is where a fluidics run is debugged, and the library's DEBUG lines (valve
routing, sequence contents) belong there. A filter on the run.log handler now
passes every fluidics record and the rest of Squid's logging at INFO and above,
so the Timer and MCU DEBUG traffic stays out.

The fluidics logger names now live in control/core/fluidics_protocol/logger_names.py,
used by run.log, the Fluidics Log pane and the library logging bridge (they were
two copies). add_file_handler takes a record_filter, attached before the handler
goes on the logger.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hongquanli hongquanli changed the title fix(fluidics): write the protocol run's run.log at INFO; DEBUG stays in main_hcs.log fix(fluidics): keep fluidics DEBUG in run.log; the rest of Squid's logging at INFO and above Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant