Skip to content

Add captureActivityLogs to CSharpExtensionExports#9029

Merged
JoeRobich merged 3 commits intomainfrom
copilot/add-capture-activity-logs-function
Feb 25, 2026
Merged

Add captureActivityLogs to CSharpExtensionExports#9029
JoeRobich merged 3 commits intomainfrom
copilot/add-capture-activity-logs-function

Conversation

Copy link
Contributor

Copilot AI commented Feb 25, 2026

Adds a programmatic API for capturing C# extension activity logs, similar to the csharp.captureLogs command but designed for API consumers rather than interactive use.

Changes

CSharpExtensionExports API (src/csharpExtensionExports.ts)

  • New ActivityLogCapture interface: disposable, exposes getActivityLogs() returning { csharpLog, lspTraceLog, razorLog }
  • New captureActivityLogs(): Promise<ActivityLogCapture> on CSharpExtensionExports

Implementation (src/lsptoolshost/activate.ts, src/activateRoslyn.ts)

  • createCaptureActivityLogs(languageServer, razorLogger) wires up observers on the module-level _channel/_traceChannel and sets log levels to Trace for the duration of the capture
  • Disposing resets all log levels (LSP server, trace client, Razor) back to their original values

Usage

const exports = await vscode.extensions.getExtension('ms-dotnettools.csharp')?.activate();
const capture = await exports.captureActivityLogs();

// ... do work ...

const { csharpLog, lspTraceLog, razorLog } = capture.getActivityLogs();
await capture.dispose(); // restores log levels

Co-authored-by: JoeRobich <611219+JoeRobich@users.noreply.github.com>
Copilot AI changed the title [WIP] Add captureActivityLogs function to CSharpExtensionExports Add captureActivityLogs to CSharpExtensionExports Feb 25, 2026
…use it

Co-authored-by: JoeRobich <611219+JoeRobich@users.noreply.github.com>
@JoeRobich JoeRobich marked this pull request as ready for review February 25, 2026 20:58
@JoeRobich JoeRobich requested a review from a team as a code owner February 25, 2026 20:58
@JoeRobich JoeRobich merged commit bf038f9 into main Feb 25, 2026
34 checks passed
@JoeRobich JoeRobich deleted the copilot/add-capture-activity-logs-function branch February 25, 2026 22:15
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.

4 participants