def init_spider_log(spider_global_variable):
 spider_logger = logging.getLogger('MSpiderLogs')
 spider_logger.setLevel(logging.DEBUG)
 console_handler = logging.StreamHandler()
 console_handler.setLevel(logging.DEBUG)
 formatter = logging.Formatter('[%(asctime)s] [%(levelname)s] %(message)s')
 console_handler.setFormatter(formatter)
 spider_logger.addHandler(console_handler)
 spider_global_variable.spider_logger = spider_logger
 spider_logger.info('Welcome to Mspider !!!')
 spider_logger.info('---------------------------')

def init_spider_log ( spider_global_variable ) : spider_logger = logging . getLogger ( 'MSpiderLogs' ) spider_logger . setLevel ( logging . DEBUG ) console_handler = logging . StreamHandler ( ) console_handler . setLevel ( logging . DEBUG ) formatter = logging . Formatter ( '[%(asctime)s] [%(levelname)s] %(message)s' ) console_handler . setFormatter ( formatter ) spider_logger . addHandler ( console_handler ) spider_global_variable . spider_logger = spider_logger spider_logger . info ( 'Welcome to Mspider !!!' ) spider_logger . info ( '---------------------------' )
logs msg定义如下 function: init_spider_log .