Use in logging
suggest changeWhen configuring the built-in logging functionality, a common pattern is to create a logger with the __name__ of the current module:
import logging
logger = logging.getLogger(__name__)
The logger’s name is then the module name, which appears in the log when the format includes %(name)s. The default basicConfig format does. When the file is run as the main program, __name__ is '__main__', so the logger is named __main__ rather than the module’s import name.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents