Skip to content

Add configurable log level across LSP server, VS, and VS Code clients - #22

Merged
clrudolphi merged 2 commits into
masterfrom
fix/configurable-log-level
Jul 2, 2026
Merged

Add configurable log level across LSP server, VS, and VS Code clients#22
clrudolphi merged 2 commits into
masterfrom
fix/configurable-log-level

Conversation

@clrudolphi

Copy link
Copy Markdown
Collaborator

Summary

Fixes #16 — every logging path was hardcoded to maximum verbosity with no way to turn it down and no consistency between client and server.

  • LSP server accepts --log-level <Off|Error|Warning|Info|Verbose> (default Warning), driving both file logging and the OmniSharp protocol-logging pipeline from the same value instead of independently hardcoding Trace.
  • VS client passes --log-level Warning when spawning the server.
  • VS Code's existing reqnroll.trace.server setting now also maps onto the server's --log-level, instead of only gating the client-side wire trace.
  • SynchronousFileLogger gained a level constructor parameter, with its previous hardcoded Verbose default flipped to Warning (quiets ~19 VS extension call sites with no per-file edits).
  • Bug fix: SynchronousFileLogger.Log() overrode the base class and skipped its level filter entirely, writing every message unconditionally regardless of configured level — found while writing the filtering test, fixed since it would have made the level plumbing a no-op for file logging.
  • Log rotation (also raised in the issue) turned out to already exist (AsynchronousFileLogger.DeleteOldLogFiles, 10-day retention) — no action needed.

Second commit: fixes the VS Code extension's npm test harness, which was never actually running any tests (extensionTestsPath pointed at a compiled test file instead of a Mocha bootstrapper, so suite/test globals were never registered and every test threw before running). Discovered while adding the traceServerToLogLevel test. Also fixes a real 2000ms-sleep-vs-2000ms-timeout race this surfaced in an existing test.

Not addressed (deliberately out of scope): a VS Options UI to let users override the level at runtime — no existing settings-page infrastructure in the [VisualStudioContribution] model to hook into; worth its own follow-up if wanted.

Test plan

  • dotnet test — Common (65), LSP Server unit (516), LSP Server specs (131), VS extension (74) — all pass
  • npm test (VS Code) — 16/16 pass (previously 0 tests were actually executing)
  • Manual verification that SynchronousFileLogger drops below-threshold messages and writes at-or-above-threshold ones

🤖 Generated with Claude Code

clrudolphi and others added 2 commits July 2, 2026 15:48
Every logging path was hardcoded to maximum verbosity with no lever to
turn it down (issue #16). The server now accepts --log-level, defaulting
to Warning, and drives both its file logging and the OmniSharp protocol
logging pipeline from the same value. The VS client passes --log-level
Warning when spawning the server; VS Code's existing reqnroll.trace.server
setting now also maps onto the server's --log-level instead of only
gating the client-side wire trace.

While adding filtering tests, found that SynchronousFileLogger.Log()
overrode the base class's level check and wrote every message
unconditionally regardless of the configured Level — fixed, since it
would have made the above plumbing a no-op for file logging.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
runTest.ts pointed extensionTestsPath directly at the compiled
extension.test.js instead of a Mocha bootstrapper, so the suite/test
BDD globals were never registered — every test threw ReferenceError:
suite is not defined before running, and npm test failed with exit
code 1 without a single test actually executing. Added index.ts to
register Mocha and run the bundled tests; this also surfaced a genuine
race in "Language client should start after activation" (a 2000ms
sleep against Mocha's default 2000ms timeout), fixed by raising the
suite timeout.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@clrudolphi
clrudolphi merged commit a0e4028 into master Jul 2, 2026
6 checks passed
@clrudolphi
clrudolphi deleted the fix/configurable-log-level branch July 2, 2026 20:52
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.

LSP server and VS client have no configurable log level — both hardcode maximum verbosity

1 participant