@@ -16,13 +16,18 @@ export interface LogMessage {
1616
1717export 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 } ` ) ;
0 commit comments