Use in logging

suggest change

When 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.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents