From 29ac10a3829b2adec1feb1e780d14eeb647a7271 Mon Sep 17 00:00:00 2001 From: Jairo Panduro Date: Fri, 17 Mar 2023 13:50:12 +0100 Subject: [PATCH] fix: STRF-10408 Fix unknown level error --- index.js | 2 +- spec/index.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index ad3b63c..99c9e68 100644 --- a/index.js +++ b/index.js @@ -360,7 +360,7 @@ class HandlebarsRenderer { */ _overrideConsoleLog() { if (this.logger !== console) { - console.log = this.logger.log.bind(this.logger); + console.log = this.logger.info.bind(this.logger); console.info = this.logger.info.bind(this.logger); console.error = this.logger.error.bind(this.logger); console.warn = this.logger.warn.bind(this.logger); diff --git a/spec/index.js b/spec/index.js index 1a1b65c..3d325bb 100644 --- a/spec/index.js +++ b/spec/index.js @@ -417,7 +417,6 @@ describe('logging', () => { beforeEach(done => { sandbox = Sinon.createSandbox(); logger = { - log: Sinon.fake(), info: Sinon.fake(), warn: Sinon.fake(), error: Sinon.fake(), @@ -448,7 +447,7 @@ describe('logging', () => { it('log helper should not be called, when log level = error', done => { renderer = new HandlebarsRenderer({}, {}, 'v4', logger, 'error'); renderer.renderString('{{log bar}}', context).then(() => { - expect(logger.log.called).to.equal(false); + expect(logger.info.called).to.equal(false); done(); }); }); @@ -456,7 +455,7 @@ describe('logging', () => { it('log helper should not be called, when log level = warning', done => { renderer = new HandlebarsRenderer({}, {}, 'v4', logger, 'warning'); renderer.renderString('{{log bar}}', context).then(() => { - expect(logger.log.called).to.equal(false); + expect(logger.info.called).to.equal(false); done(); }); }); @@ -489,7 +488,7 @@ describe('logging', () => { it('should override default console.log', done => { renderer = new HandlebarsRenderer({}, {}, 'v4', logger); console.log('test'); - expect(logger.log.calledWith('test')).to.equal(true); + expect(logger.info.calledWith('test')).to.equal(true); done(); });