How to get current file name, function name and line number?
I want to use it for logging/debugging purpose, equivalent to __FILE__
, __LINE__
You might also look at console-plus. This adds filename and linenumber to any logging text and has different colours for .log, .info and .error.
Well, I wanted to use the file name as the tag for the logger so the most straight forward and what I wanted is this:
__filename.substring(__dirname.length + 1, __filename.lastIndexOf("."))