Am I the only one not having trouble with this 'solution': https://forum.arduino.cc/t/filename-extraction-from-file/676395 ?
I looks like someone copied a solution for Mac OS, where the path names use slashes instead of backslashes, and replaced the /'s with 's. Sadly this does not work on my Windows 10 laptop, with a compiling error saying " stray \ " etc.
Solution found, however: just use double backslashes:
#define __FILENAME__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
Works like a charm.
Hope this was helpful.