Skip to content

Instantly share code, notes, and snippets.

@ThrowsException
Created March 2, 2015 21:06
Show Gist options
  • Save ThrowsException/d427b872f9e8a3979b4c to your computer and use it in GitHub Desktop.
Save ThrowsException/d427b872f9e8a3979b4c to your computer and use it in GitHub Desktop.
def create_app(config_settings=None):
app = Flask(__name__)
file_handler = RotatingFileHandler('app.log')
file_handler.setFormatter(Formatter(
'%(asctime)s %(levelname)s: %(message)s '
'[in %(pathname)s:%(lineno)d]'
))
file_handler.setLevel(logging.DEBUG)
app.logger.addHandler(file_handler)
# without this line I don't get any log
# statements written to my file when
# using current_app.logger.info("")
# in my blueprint
app.logger.setLevel(logging.DEBUG)
app.register_blueprint(frontend)
return app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment