From 091a24423bb9c28b7371e7af849b15c7e39747fa Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Tue, 2 Feb 2021 12:20:20 +0100 Subject: [PATCH] fix: skip logObj check for wrapped calls (fixes #109) --- src/consola.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/consola.js b/src/consola.js index d88784ac..7fcdbd2d 100644 --- a/src/consola.js +++ b/src/consola.js @@ -192,16 +192,16 @@ class Consola { _wrapLogFn (defaults) { function logFn () { if (paused) { - queue.push([this, defaults, arguments]) + queue.push([this, defaults, arguments, true]) return } - return this._logFn(defaults, arguments) + return this._logFn(defaults, arguments, true) } return logFn.bind(this) } - _logFn (defaults, args) { + _logFn (defaults, args, isWrapped) { if (defaults.level > this.level) { return this._async ? Promise.resolve(false) : false } @@ -213,7 +213,7 @@ class Consola { }, defaults) // Consume arguments - if (args.length === 1 && isLogObj(args[0])) { + if (!isWrapped && args.length === 1 && isLogObj(args[0])) { Object.assign(logObj, args[0]) } else { logObj.args = Array.from(args)