From c3bb36bad92d4148df5febc4a028b5516457f6a2 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Wed, 22 Oct 2025 16:11:22 -0700 Subject: [PATCH] if trace, debug each AND remove array.from --- src/common/InputHandler.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/common/InputHandler.ts b/src/common/InputHandler.ts index 9608af713..e935d9189 100644 --- a/src/common/InputHandler.ts +++ b/src/common/InputHandler.ts @@ -444,11 +444,15 @@ export class InputHandler extends Disposable implements IInputHandler { } // Log debug data, the log level gate is to prevent extra work in this hot path - this._logService.debug(`parsing data ${typeof data === 'string' ? ` "${data}"` : ` "${Array.prototype.map.call(data, e => String.fromCharCode(e)).join('')}"`}`); - this._logService.trace(`parsing data (codes)`, () => typeof data === 'string' - ? data.split('').map(e => e.charCodeAt(0)) - : Array.from(data) - ); + if (this._logService.logLevel === LogLevelEnum.DEBUG) { + this._logService.debug(`parsing data ${typeof data === 'string' ? ` "${data}"` : ` "${Array.prototype.map.call(data, e => String.fromCharCode(e)).join('')}"`}`); + } + if (this._logService.logLevel === LogLevelEnum.TRACE) { + this._logService.trace(`parsing data (codes)`, () => typeof data === 'string' + ? data.split('').map(e => e.charCodeAt(0)) + : data + ); + } // resize input buffer if needed if (this._parseBuffer.length < data.length) {