Skip to content

Commit

Permalink
Add new MergedOutputChannel log
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinGrote committed Nov 9, 2024
1 parent e6c84b8 commit d1cdc8c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,20 @@ export class LanguageClientOutputChannelAdapter implements LogOutputChannel {
// #endregion
}

/** Appends additional */
export class PsesMergedOutputChannel extends LanguageClientOutputChannelAdapter {
public override appendLine(message: string): void {
this.append(message);
}

public override append(message: string): void {
const [parsedMessage, level] = this.parse(message);

// Append PSES prefix to log messages to differentiate them from Client messages
this.sendLogMessage("[PSES] " + parsedMessage, level);
}
}

/** Overrides the severity of some LSP traces to be more logical */
export class LanguageClientTraceFormatter extends LanguageClientOutputChannelAdapter {
public override appendLine(message: string): void {
Expand Down
4 changes: 2 additions & 2 deletions src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import path = require("path");
import vscode = require("vscode");
import TelemetryReporter, { TelemetryEventProperties, TelemetryEventMeasurements } from "@vscode/extension-telemetry";
import { Message, Trace } from "vscode-jsonrpc";
import { ILogger, LanguageClientOutputChannelAdapter, LanguageClientTraceFormatter } from "./logging";
import { ILogger, LanguageClientOutputChannelAdapter, LanguageClientTraceFormatter, PsesMergedOutputChannel } from "./logging";

Check failure on line 9 in src/session.ts

View workflow job for this annotation

GitHub Actions / node (macos-latest)

'LanguageClientOutputChannelAdapter' is defined but never used

Check failure on line 9 in src/session.ts

View workflow job for this annotation

GitHub Actions / node (ubuntu-latest)

'LanguageClientOutputChannelAdapter' is defined but never used
import { PowerShellProcess } from "./process";
import { Settings, changeSetting, getSettings, getEffectiveConfigurationTarget, validateCwdSetting } from "./settings";
import utils = require("./utils");
Expand Down Expand Up @@ -690,7 +690,7 @@ export class SessionManager implements Middleware {
middleware: this,
traceOutputChannel: new LanguageClientTraceFormatter("PowerShell: Trace LSP"),
// This is named the same as the Client log to merge the logs, but will be handled and disposed separately.
outputChannel: new LanguageClientOutputChannelAdapter("PowerShell"),
outputChannel: new PsesMergedOutputChannel("PowerShell"),
revealOutputChannelOn: RevealOutputChannelOn.Never
};

Expand Down

0 comments on commit d1cdc8c

Please sign in to comment.