Skip to content

Quiet terminal output by default (opt-in verbose logging)#21

Merged
dnkats merged 1 commit into
mainfrom
fix/quiet-startup-logging
May 31, 2026
Merged

Quiet terminal output by default (opt-in verbose logging)#21
dnkats merged 1 commit into
mainfrom
fix/quiet-startup-logging

Conversation

@dnkats

@dnkats dnkats commented May 31, 2026

Copy link
Copy Markdown
Member

Problem

npm start floods the terminal with the main process's per-event log (startup info, focus/blur, memory stats) and Chromium's GPU/init ERROR lines, e.g.:

2026-05-31T15:12:01.387Z: Application starting [Memory: RSS=49MB, Heap=4MB]
...
[34792:...:ERROR:components\viz\service\main\viz_main_impl.cc:189] Exiting GPU process due to errors during initialization
2026-05-31T15:12:02.067Z: Window gained focus [Memory: RSS=90MB, Heap=5MB]

Fix

  • log() now only echoes to the terminal when verbose logging is enabled. The full jsmol.log file (in the app's user-data directory) is always written, so troubleshooting info is preserved.
  • Chromium's own console output is quieted (--log-level=3, fatal only) unless verbose/--enable-logging is set — this removes the GPU init ERROR noise.
  • Verbose logging is opt-in via --verbose/--debug, JLMOL_DEBUG=1, or the new npm run start-verbose script.
  • The log-file write is wrapped in try/catch so logging can never break the app.

Note: this is gated by a CLI flag / env var rather than the in-app Settings, because the main-process logging runs at startup before the renderer (where preferences live in localStorage) is available.

Testing

  • node --check main.js and package.json JSON both validate.
  • npm start should now be quiet; npm run start-verbose restores the detailed terminal log.

🤖 Generated with Claude Code

The Electron main process logged every event (startup, focus/blur, memory
stats) to the terminal, and Chromium printed GPU/init errors, cluttering
the console on `npm start`.

- log() now only echoes to the terminal when verbose logging is enabled
  (--verbose/--debug flag or JLMOL_DEBUG=1); the full jsmol.log file is
  always written for troubleshooting.
- Suppress Chromium's own ERROR/INFO output (log-level=3) unless verbose
  or --enable-logging is set.
- Add `npm run start-verbose` and wrap the log write in try/catch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 31, 2026 15:19
@dnkats dnkats merged commit 290cb3f into main May 31, 2026
1 check failed
@dnkats dnkats deleted the fix/quiet-startup-logging branch May 31, 2026 15:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

2 participants