code: def setup_logging():
      
      default_path_yaml = os.path.expanduser('~/.pylogconf.yaml')
      default_path_conf = os.path.expanduser('~/.pylogconf.conf')
      # this matches the default logging level of the logging
      # library and makes sense...
      default_level = logging.WARNING
  
      dbg = os.getenv("PYLOGCONF_DEBUG", False)
  
      """ try YAML config file first """
      value = os.getenv('PYLOGCONF_YAML', None)
      if value is None:
          path = default_path_yaml
      else:
          path = value
      if os.path.isfile(path):
          _debug('found logging configuration file [{0}]...'.format(path), dbg)
          with open(path) as f:
              config = yaml.load(f.read())
              logging.config.dictConfig(config)
              return
  
      """ Now try regular config file """
      value = os.getenv('PYLOGCONF_CONF', None)
      if value is None:
          path = default_path_conf
      else:
          path = value
      if os.path.isfile(path):
          _debug('found logging configuration file [{0}]...'.format(path), dbg)
          logging.config.fileConfig(path)
          return
  
      _debug('logging with level [{0}]...'.format(default_level), dbg)
      logging.basicConfig(level=default_level)
docs: setup the logging system