Skip to content

Commit 8146633

Browse files
committed
Logging now Warn by default
1 parent f36532c commit 8146633

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

client/src/logger.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ export interface LogMessage {
1616

1717
export class VscodeLogger {
1818
private static _outputChannel: vscode.OutputChannel;
19-
static get outputChannel(): vscode.OutputChannel {
19+
private static get outputChannel(): vscode.OutputChannel {
2020
if (!VscodeLogger._outputChannel) {
2121
VscodeLogger._outputChannel = vscode.window.createOutputChannel('VBAPro Output');
2222
VscodeLogger._outputChannel.show();
2323
}
2424
return VscodeLogger._outputChannel;
2525
}
26+
private static get configuredLevel(): LogLevel {
27+
const config = vscode.workspace.getConfiguration('vbaLanguageServer');
28+
const levelString = config.get<string>('logLevel.outputChannel', 'warning');
29+
return LogLevel[levelString as keyof typeof LogLevel];
30+
}
2631

2732
static info = (msg: string, lvl?: number) => this.log(LogLevel.info, msg, lvl)
2833
static debug = (msg: string, lvl?: number) => this.log(LogLevel.debug, msg, lvl)
@@ -32,6 +37,8 @@ export class VscodeLogger {
3237
}
3338

3439
private static log(type: LogLevel, msg: string, lvl?: number): void {
40+
if (type > this.configuredLevel) return;
41+
3542
const i = '> '.repeat(lvl ?? 0);
3643
const t = `${this.getFormattedTimestamp()}`;
3744
VscodeLogger.outputChannel.appendLine(`${t} [${LogLevel[type]}] ${i}${msg}`);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"Warn",
9090
"Error"
9191
],
92-
"default": "Info",
92+
"default": "Warn",
9393
"description": "Sets the logging level for the output channel."
9494
},
9595
"vbaLanguageServer.maxDocumentLines": {

0 commit comments

Comments
 (0)