old_contents: from . import extensions
  from .views import views
  from .api import api
  from .push import push
  import flask
  
  
  def create_app(config_path='../woodwind.cfg'):
      app = flask.Flask('woodwind')
      app.config.from_pyfile(config_path)
      if not app.debug:
          import logging
          import sys
          app.logger.setLevel(logging.DEBUG)
          app.logger.addHandler(logging.StreamHandler(sys.stdout))
      extensions.init_app(app)
      app.register_blueprint(views)
      app.register_blueprint(api)
      app.register_blueprint(push)
      return app
  
new_contents: from woodwind import extensions
  from woodwind.api import api
  from woodwind.push import push
  from woodwind.views import views
  import flask
  import logging
  import sys
  
          
  MAIL_FORMAT = '''\
  Message type:       %(levelname)s
  Location:           %(pathname)s:%(lineno)d
  Module:             %(module)s
  Function:           %(funcName)s
  Time:               %(asctime)s
  
  Message:
  
  %(message)s
  '''
  
  
  def create_app(config_path='../woodwind.cfg'):
      app = flask.Flask('woodwind')
      app.config.from_pyfile(config_path)
      configure_logging(app)
      
      extensions.init_app(app)
      app.register_blueprint(views)
      app.register_blueprint(api)
      app.register_blueprint(push)
      return app
  
      
  def configure_logging(app):
      if app.debug:
          return
          
      app.logger.setLevel(logging.DEBUG)
      app.logger.addHandler(logging.StreamHandler(sys.stdout))
  
      recipients = app.config.get('ADMIN_EMAILS')
      if recipients:
          error_handler = logging.handlers.SMTPHandler(
              'localhost', 'Woodwind <woodwind@kylewm.com>', 
              recipients, 'woodwind error')
          error_handler.setLevel(logging.ERROR)
          error_handler.setFormatter(logging.Formatter(MAIL_FORMAT))
          app.logger.addHandler(error_handler)
  
  
subject: enable email error logging