Skip to content

Route extension logs through the BrightScript Extension output channel - #802

Open
chrisdp wants to merge 5 commits into
masterfrom
feature/extension-logger
Open

Route extension logs through the BrightScript Extension output channel#802
chrisdp wants to merge 5 commits into
masterfrom
feature/extension-logger

Conversation

@chrisdp

@chrisdp chrisdp commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds src/logging.ts, a shared logger (built on @rokucommunity/logger) that writes to the developer console and to the existing BrightScript Extension output channel. The channel is already piped into the optional brightscript.extensionLogfilePath setting, so file logging works without further wiring.
  • Migrates all console.* calls across the extension source (~45 call sites in 19 files) to the shared logger, each file tagged with a component-named sub-logger (e.g. [LanguageServerManager]) so messages are attributable in the output channel.
  • The LSP keeps its own BrightScript Language Server output channel — only extension-level logs route through the shared logger.

Motivation

End-users currently can't see extension logs — the console.* calls scattered across the source only surface in the Extension Host devtools. This routes them to the BrightScript Extension output channel (and thus the logfile setting) without each call site needing to know about the channel.

Notes

  • Mapping is behavior-preserving: console.loglogger.log, warnwarn, errorerror. (In @rokucommunity/logger, info is more verbose than log, so logger.info would have been silently dropped at the default log level.)
  • Skipped: the Perfetto editor's inline webview script (runs in the webview, not the extension host) and webviews/ sources.
  • Open question: should there be a brightscript.logLevel setting to control verbosity? A few noisy call sites (e.g. DeviceManager.resolveDevice tracing) could then be demoted to debug/trace.

Adds a shared logger (built on @rokucommunity/logger) that writes to both
the developer console and the BrightScript Extension output channel, so
end-users can see extension logs without attaching a debugger. The channel
is already wired to the optional brightscript.extensionLogfilePath sink,
so file logging works automatically.

LanguageServerManager is migrated as a proof of concept. The remaining
console.* call sites can be moved over in a follow-up sweep.
Comment thread src/logging.ts
@chrisdp chrisdp self-assigned this Jul 24, 2026
chrisdp added 4 commits July 24, 2026 09:55
…ions

Also export a bound `createLogger` helper, matching the pattern used in
brighterscript and roku-debug.
`logger.info` is below the shared logger's 'log' threshold in
@rokucommunity/logger (error < warn < log < info), so the migrated
onDidChangeState message was silently dropped. Use `logger.log` to
preserve the original console.log behavior.
Mechanical mapping (console.log→logger.log, warn→warn, error→error)
across 19 files, each with a component-named sub-logger. Commented-out
console calls were updated too so they stay consistent if re-enabled.
Skipped: the Perfetto webview inline script (runs in the webview, not
the extension host) and webviews/ sources.
@chrisdp
chrisdp marked this pull request as ready for review July 24, 2026 14:27
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