You can move this instantiation to the top of the file where you say `logger = None`.