I'm looking for a simple way to make a log function.
I'm calling a function logSuc("return from Prom")
, the function is on line 30.
So the code will always point to the line 30 of that function. In the console:
So say have this code:
const logSuc = (msg) => {
console.log(`%c ${msg}`, 'background: green; color: white; display: block;');
};
An alternative could be:
const log = console.log;
function red(msg) {
return `%c ${msg}`, 'background: red; color: white; display: block;';
}
log(red('its red');
But now i have two functions and I want to keep it short and simple
So the problem is my logSuc("")
always points to line 30.
But I want it to be point to the line where I call logSuc("that worked").