old_contents: # coding:utf-8
  import os
  import logging
  import logging.config as log_conf
  
  log_path = os.path.join(os.path.dirname(os.path.dirname(__file__))+'/logs', 'weibo.log')
  
  log_config = {
      'version': 1.0,
      'formatters': {
          'detail': {
              'format': '%(asctime)s - %(name)s - %(levelname)s - %(message)s',
              'datefmt': "%Y-%m-%d %H:%M:%S"
          },
          'simple': {
              'format': '%(name)s - %(levelname)s - %(message)s',
          },
      },
      'handlers': {
          'console': {
              'class': 'logging.StreamHandler',
              'level': 'INFO',
              'formatter': 'detail'
          },
          'file': {
              'class': 'logging.handlers.RotatingFileHandler',
              'maxBytes': 1024 * 1024 * 5,
              'backupCount': 10,
              'filename': log_path,
              'level': 'INFO',
              'formatter': 'detail',
              'encoding': 'utf-8',
          },
      },
      'loggers': {
          'crawler': {
              'handlers': ['console', 'file'],
              'level': 'DEBUG',
          },
          'parser': {
              'handlers': ['file'],
              'level': 'INFO',
          },
          'other': {
              'handlers': ['console', 'file'],
              'level': 'INFO',
          },
          'storage': {
              'handlers': ['file'],
              'level': 'INFO',
          }
      }
  }
  
  log_conf.dictConfig(log_config)
  
  other = logging.getLogger('other')
  crawler = logging.getLogger('crawler')
  parser = logging.getLogger('page_parser')
  storage = logging.getLogger('storage')
  
  
  __all__ = ['crawler', 'parser', 'other', 'storage']
  
  
  
new_contents: # coding:utf-8
  import os
  import logging
  import logging.config as log_conf
  
  log_dir = os.path.dirname(os.path.dirname(__file__))+'/logs'
  if not os.path.exists(log_dir):
      os.mkdir(log_dir)
  
  log_path = os.path.join(log_dir, 'weibo.log')
  
  log_config = {
      'version': 1.0,
      'formatters': {
          'detail': {
              'format': '%(asctime)s - %(name)s - %(levelname)s - %(message)s',
              'datefmt': "%Y-%m-%d %H:%M:%S"
          },
          'simple': {
              'format': '%(name)s - %(levelname)s - %(message)s',
          },
      },
      'handlers': {
          'console': {
              'class': 'logging.StreamHandler',
              'level': 'INFO',
              'formatter': 'detail'
          },
          'file': {
              'class': 'logging.handlers.RotatingFileHandler',
              'maxBytes': 1024 * 1024 * 5,
              'backupCount': 10,
              'filename': log_path,
              'level': 'INFO',
              'formatter': 'detail',
              'encoding': 'utf-8',
          },
      },
      'loggers': {
          'crawler': {
              'handlers': ['console', 'file'],
              'level': 'DEBUG',
          },
          'parser': {
              'handlers': ['file'],
              'level': 'INFO',
          },
          'other': {
              'handlers': ['console', 'file'],
              'level': 'INFO',
          },
          'storage': {
              'handlers': ['file'],
              'level': 'INFO',
          }
      }
  }
  
  log_conf.dictConfig(log_config)
  
  other = logging.getLogger('other')
  crawler = logging.getLogger('crawler')
  parser = logging.getLogger('page_parser')
  storage = logging.getLogger('storage')
  
  
  __all__ = ['crawler', 'parser', 'other', 'storage']
  
  
  
subject: 添加logs文件夹的判断，如果没有，那么就建立