forked from vscode-kubernetes-tools/vscode-kubernetes-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.ts
27 lines (23 loc) · 740 Bytes
/
logger.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import * as vscode from 'vscode';
const HELM_CHANNEL = "Helm";
interface Logger extends vscode.Disposable {
log(msg: string): void;
}
// LoggingConsole provides a log-like facility for sending messages to a shared output channel.
//
// A console is disposable, since it allocates a channel.
class LoggingConsole implements Logger {
channel: vscode.OutputChannel;
constructor(channelName: string) {
this.channel = vscode.window.createOutputChannel(channelName);
}
log(msg: string) {
this.channel.append(msg);
this.channel.append("\n");
this.channel.show(true);
}
dispose() {
this.channel.dispose();
}
}
export const helm: Logger = new LoggingConsole(HELM_CHANNEL);