Because if you examine what __ENV__.function actually returns it is not an atom. It’s a tuple {function_name, arity}.
BTW, the Logger has really good metadata support and the Logger macros (like Logger.error/2 already capture the module and function. You just need to whitelist them in your config.exs for the console backend. For verbose output (might be useful in development) try: