In C programming language, it's typical to log a message with filename and line number of the source code file the message is coming from:
#define log(fmt, ...) printf("%s:%d: " fmt "\n", __file__, __LINE__, ##__VA_ARGS__);
I would want to do that in vimscript.
function! log(msg) abort
echom previous_vimscript_name().':'.previous_vimscript_line().': '.msg
endfunction
How would I do that? echom
only prints the message, I would want to print where it comes from.