@@ -95,9 +95,12 @@ export class LogFunctionLogger extends Disposable implements ILogger {
9595 return ;
9696 }
9797
98- this . appendLine ( `[lsp-${ this . toLevelLabel ( level ) } ] ${ message } ` ) ;
98+ // Mention log level because until we switch to languageclient 10.x, the
99+ // output channel will use the `info` level for all our messages.
100+ // See https://github.com/microsoft/vscode-languageserver-node/issues/1116.
101+ this . appendLine ( level , `[lsp-${ this . toLevelLabel ( level ) } ] ${ message } ` ) ;
99102 if ( data ) {
100- this . appendLine ( LogFunctionLogger . data2String ( data ) ) ;
103+ this . appendLine ( level , LogFunctionLogger . data2String ( data ) ) ;
101104 }
102105 }
103106
@@ -134,10 +137,28 @@ export class LogFunctionLogger extends Disposable implements ILogger {
134137 }
135138 }
136139
137- private appendLine ( value : string ) : void {
140+ private appendLine ( level : LogLevel , value : string ) : void {
138141 // If we're connected, send log messages to client as LSP notifications
139142 if ( this . _connection ) {
140- this . _connection . console . log ( value ) ;
143+ // The log level is not currently forwarded to our `LogOutputChannel` on
144+ // the client side. We'll need to update to languageclient 10.x for this,
145+ // see https://github.com/microsoft/vscode-languageserver-node/issues/1116.
146+ switch ( level ) {
147+ case LogLevel . Error :
148+ this . _connection . console . error ( value ) ;
149+ break ;
150+ case LogLevel . Warn :
151+ this . _connection . console . warn ( value ) ;
152+ break ;
153+ case LogLevel . Info :
154+ this . _connection . console . info ( value ) ;
155+ break ;
156+ case LogLevel . Debug :
157+ case LogLevel . Trace :
158+ default :
159+ this . _connection . console . log ( value ) ;
160+ break ;
161+ }
141162 } else {
142163 this . _logFn ( value ) ;
143164 }
0 commit comments