def _setup_log(self):
        '''Set up the logging file.'''
        logger = logging.getLogger()
        formatter = logging.Formatter(
            '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
        self._log_temp_file = NamedTemporaryFile(
            prefix='tmp-wpull-warc-',
            dir=self._params.temp_dir,
            suffix='.log.gz',
            delete=False,
        )
        self._log_temp_file.close()  # For Windows

        self._log_handler = handler = logging.StreamHandler(
            io.TextIOWrapper(
                gzip.GzipFile(
                    filename=self._log_temp_file.name, mode='wb'
                ),
                encoding='utf-8'
            )
        )

        logger.setLevel(logging.DEBUG)
        logger.debug('Wpull needs the root logger level set to DEBUG.')

        handler.setFormatter(formatter)
        logger.addHandler(handler)
        handler.setLevel(logging.INFO)
def _setup_log ( self ) : logger = logging . getLogger ( ) formatter = logging . Formatter ( '%(asctime)s - %(name)s - %(levelname)s - %(message)s' ) self . _log_temp_file = NamedTemporaryFile ( prefix = 'tmp-wpull-warc-' , dir = self . _params . temp_dir , suffix = '.log.gz' , delete = False , ) self . _log_temp_file . close ( ) self . _log_handler = handler = logging . StreamHandler ( io . TextIOWrapper ( gzip . GzipFile ( filename = self . _log_temp_file . name , mode = 'wb' ) , encoding = 'utf-8' ) ) logger . setLevel ( logging . DEBUG ) logger . debug ( 'Wpull needs the root logger level set to DEBUG.' ) handler . setFormatter ( formatter ) logger . addHandler ( handler ) handler . setLevel ( logging . INFO )
Set up the logging file.