@@ -224,40 +224,48 @@ export class ConsoleLogInMainService extends AbstractLogService implements ILogS
224224
225225 trace ( message : string , ...args : any [ ] ) : void {
226226 if ( this . getLevel ( ) <= LogLevel . Trace ) {
227- this . client . consoleLog ( 'trace' , [ message , ...args ] ) ;
227+ this . client . consoleLog ( 'trace' , [ this . extractMessage ( message ) , ...args ] ) ;
228228 }
229229 }
230230
231231 debug ( message : string , ...args : any [ ] ) : void {
232232 if ( this . getLevel ( ) <= LogLevel . Debug ) {
233- this . client . consoleLog ( 'debug' , [ message , ...args ] ) ;
233+ this . client . consoleLog ( 'debug' , [ this . extractMessage ( message ) , ...args ] ) ;
234234 }
235235 }
236236
237237 info ( message : string , ...args : any [ ] ) : void {
238238 if ( this . getLevel ( ) <= LogLevel . Info ) {
239- this . client . consoleLog ( 'info' , [ message , ...args ] ) ;
239+ this . client . consoleLog ( 'info' , [ this . extractMessage ( message ) , ...args ] ) ;
240240 }
241241 }
242242
243243 warn ( message : string | Error , ...args : any [ ] ) : void {
244244 if ( this . getLevel ( ) <= LogLevel . Warning ) {
245- this . client . consoleLog ( 'warn' , [ message , ...args ] ) ;
245+ this . client . consoleLog ( 'warn' , [ this . extractMessage ( message ) , ...args ] ) ;
246246 }
247247 }
248248
249249 error ( message : string | Error , ...args : any [ ] ) : void {
250250 if ( this . getLevel ( ) <= LogLevel . Error ) {
251- this . client . consoleLog ( 'error' , [ toErrorMessage ( message , this . getLevel ( ) <= LogLevel . Trace ) , ...args ] ) ;
251+ this . client . consoleLog ( 'error' , [ this . extractMessage ( message ) , ...args ] ) ;
252252 }
253253 }
254254
255255 critical ( message : string | Error , ...args : any [ ] ) : void {
256256 if ( this . getLevel ( ) <= LogLevel . Critical ) {
257- this . client . consoleLog ( 'critical' , [ toErrorMessage ( message , this . getLevel ( ) <= LogLevel . Trace ) , ...args ] ) ;
257+ this . client . consoleLog ( 'critical' , [ this . extractMessage ( message ) , ...args ] ) ;
258258 }
259259 }
260260
261+ private extractMessage ( msg : string | Error ) : string {
262+ if ( typeof msg === 'string' ) {
263+ return msg ;
264+ }
265+
266+ return toErrorMessage ( msg , this . getLevel ( ) <= LogLevel . Trace ) ;
267+ }
268+
261269 dispose ( ) : void {
262270 // noop
263271 }
0 commit comments