Python logging: __name__

I’ve been using the recommended idiom of getLogger(__name__) to log stuff in Python code. That’s supposed to turn into your module name so you get nice names like “openaddr.conform” for the file openaddr/

Only it totally breaks if you invoke as a main function via python -m or the like. Because of course __name__ is set to __main__ in that condition.

Wonder why none of the logging tutorials mention that gotcha?