I have this :
//define in utils.js
function l (message) {
if (message.includes('success')) {
return console.log.bind.call(console.log, console, `%c%s`, `color:green;`)
} else {
return console.log.bind.call(console.log, console, `%c%s`)
}
}
l("success to import")("success to import") // execute in index.js
It work because I have the good color and the good row (from index.js and NOT utils.js).
But I want to be able to only write l("success this check work", some var,...)
And Not with two pair of parenthesis ...
I want to have a wrapper function which could change color based on log content : If I have succes I want green log If I have error I want red log And display the correct log row, not from utils.js but from other file js where it's called