From ca4ba54d2ef43599b53674706ae6fe3b6e92fc60 Mon Sep 17 00:00:00 2001 From: FALSAL Date: Thu, 18 Jan 2024 09:22:24 +0100 Subject: [PATCH] improve the consoleLog global function --- src/utils/globals.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/globals.js b/src/utils/globals.js index 55a5bacd..9bb16ab3 100644 --- a/src/utils/globals.js +++ b/src/utils/globals.js @@ -290,7 +290,7 @@ for (const [key, value] of searchParams) { return obj; } -export function consoleLog(textOutput, varOutput, doubleLine = false) { +export function consoleLog(textOutput ="output :", varOutput = null, doubleLine = false) { if(process.env.NODE_ENV !== "production"){ if(!!doubleLine){ console.log("----------------------------") @@ -298,7 +298,7 @@ export function consoleLog(textOutput, varOutput, doubleLine = false) { console.log(varOutput); console.log("=============================") }else{ - console.log(textOutput, varOutput); + (textOutput && varOutput) ? console.log(textOutput, varOutput) : textOutput ? console.log(textOutput) : console.log(varOutput); } return; }