To get name and line of calling function in Node.js, we use the error’s stack
property.
For instance, we write
console.log("DEBUG", new Error().stack.split("at ")[1].trim());
to create an Error
object and use its stack
property to get the name and line of the calling function.