Skip to content

Commit a903e1f

Browse files
committed
[WIP] fix up the logging a bit
It's still pretty messed up though. Seems like VS Code wants us to use its built-in log filtering tool instead of our setting. Signed-off-by: David Thompson <davthomp@redhat.com>
1 parent 3e94c1a commit a903e1f

3 files changed

Lines changed: 23 additions & 6 deletions

File tree

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
425425
return true;
426426
}
427427
},
428-
outputChannel: requireStandardServer ? window.createOutputChannel(extensionName, { log: true }) : undefined,
428+
outputChannel: requireStandardServer ? new OutputInfoCollector(extensionName) : undefined,
429429
outputChannelName: extensionName
430430
};
431431

src/javaServerStarter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export function getUnicodeLocaleEnv(): { [key: string]: string } {
128128
return env;
129129
}
130130

131-
export function awaitServerConnection(port): Thenable<StreamInfo> {
131+
export function awaitServerConnection(port): Promise<StreamInfo> {
132132
const addr = parseInt(port);
133133
return new Promise((res, rej) => {
134134
const server = net.createServer(stream => {

src/outputInfoCollector.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1-
import { OutputChannel, window, ViewColumn } from "vscode";
1+
import { Event, LogLevel, LogOutputChannel, ViewColumn, window } from "vscode";
22
import { logger } from "./log";
33

4-
export class OutputInfoCollector implements OutputChannel {
5-
private channel: OutputChannel = null;
4+
export class OutputInfoCollector implements LogOutputChannel {
5+
private channel: LogOutputChannel = null;
66

77
constructor(public name: string) {
8-
this.channel = window.createOutputChannel(this.name);
8+
this.channel = window.createOutputChannel(this.name, { log:true });
9+
}
10+
get logLevel(): LogLevel { return this.channel.logLevel; }
11+
get onDidChangeLogLevel(): Event<LogLevel> { return this.channel.onDidChangeLogLevel; };
12+
trace(message: string, ...args: any[]): void {
13+
this.channel.trace(message, args);
14+
}
15+
debug(message: string, ...args: any[]): void {
16+
this.channel.debug(message, args);
17+
}
18+
info(message: string, ...args: any[]): void {
19+
this.channel.info(message, args);
20+
}
21+
warn(message: string, ...args: any[]): void {
22+
this.channel.warn(message, args);
23+
}
24+
error(error: string | Error, ...args: any[]): void {
25+
this.channel.error(error, args);
926
}
1027

1128
append(value: string): void {

0 commit comments

Comments
 (0)