Replay pre-init config warnings into the night log (follow-up to #924) - #965
Replay pre-init config warnings into the night log (follow-up to #924)#965dvida wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b78e75de20
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for record in early_records: | ||
| main_logger.handle(record) |
There was a problem hiding this comment.
Avoid replaying buffered warnings to the console
When configuration parsing emits a WARNING+ and console_level permits it (the default is INFO), _default_handler has already printed the record to stderr. Replaying it through the root queue here sends the same record to the listener's console handler as well as its file handler, so every affected startup displays each configuration warning twice. Route replayed records only to the file sink, or mark and filter them from the listener's console handler.
Useful? React with 👍 / 👎.
Config parsing runs before initLogging in every entry point, so validation warnings (clamped FPS, bad binning factor/method, jpg/png quality ranges, FOV check, band ratios, upload disabled on the default station code) only ever reached the console and never the uploaded night log - the very log someone reads to answer "did my station configure correctly?". Add an EarlyRecordBuffer to Logger: a small capped handler on the root logger that collects WARNING+ records emitted before logging is up. initLogging drains it and replays the records into the night log with their original timestamps (InRmsFilter still drops non-RMS noise on replay). ConfigReader.parse() installs the buffer as its first step - the single funnel every config load passes through - so this rides along with the parser and needs no per-entry-point wiring. installEarlyLogBuffer is idempotent and self-managing: a no-op once real logging is initialized (a QueueHandler is present on the root logger, in the main process or a child), so a config re-parse after startup cannot leave an undrained buffer, and a bare `import RMS.ConfigReader` no longer mutates the caller's root logger. The replayed records are marked and dropped by the listener's console handler (kept by the file handler), so a config warning already printed to the console before logging came up is not shown a second time on replay. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Reprocess: collapse the night-product exception handlers onto log.warning(..., exc_info=True) instead of hand-formatting the traceback into two warning lines, and route the last FT-archiving print() calls through logging so they land in the night log with a level and timestamp. FRbinViewer: default the on-screen key legend to off so it never covers the image unless asked for (toggle with 'h'), and print the key banner to the console when a file is opened instead. README: drop RMS.ClearSkyDetector from the runnable-module list (it has no CLI entry point). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
b78e75d to
fff8601
Compare
|
Good catch — fixed in c52465b. The double print was real: Fix: replayed records are now tagged ( |
Follow-up to #924 (merged), same theme — make night-time problems visible in the uploaded night log. #924 covered night product failures; this round closes the gap it left and tidies a few related spots.
1. Replay pre-init config warnings into the night log
Config parsing runs before
initLoggingin every entry point, so config-validation warnings — clamped FPS, bad binning factor/method, jpg/png quality ranges, FOV check, band ratios, "upload disabled on the default station code" — only ever hit the console and never the uploaded night log, which is exactly where you'd look to answer "did my station configure correctly?".Fix: a small
EarlyRecordBufferon the root logger (RMS/Logger.py) collects WARNING+ records emitted before logging is up;initLoggingdrains it and replays them into the night log with their original timestamps (InRmsFilterstill drops non-RMS noise on replay).ConfigReader.parse()installs the buffer as its first step — the single funnel every config load passes through — so it rides along with the parser and needs no per-entry-point wiring.installEarlyLogBuffer()is idempotent and self-managing: a no-op once real logging is up (aQueueHandleron the root logger, main process or child), so a re-parse after startup can't leave an undrained buffer, and a bareimport RMS.ConfigReaderno longer mutates the caller's root logger.2. Tidy night-product logging (
Reprocess.py)Collapse the night-product exception handlers onto
log.warning(..., exc_info=True)instead of hand-formatting the traceback into two warning lines, and route the last FT-archivingprint()calls through logging so they land in the night log with a level and timestamp.3. FRbinViewer key legend
Default the on-screen legend to off so it never covers the image unless asked for (toggle with
h); print the key banner to the console when a file is opened instead.4. README
Drop
RMS.ClearSkyDetectorfrom the runnable-module list — it has no CLI entry point.Testing
installEarlyLogBuffer: verified a bareimport RMS.ConfigReaderinstalls no buffer; the buffer captures WARNING+ and ignores INFO;_drainEarlyLogBufferreturns the records; and it no-ops once aQueueHandleris on the root logger.ConfigReader/Loggerimport clean.🤖 Generated with Claude Code