Skip to content

Instantly share code, notes, and snippets.

@playpauseandstop
Created May 2, 2012 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save playpauseandstop/2575634 to your computer and use it in GitHub Desktop.
Save playpauseandstop/2575634 to your computer and use it in GitHub Desktop.
Disable Flask's debug logger if testing mode enabled
import logging
import os
DEBUG = False
TESTING = 'TESTING' in os.environ or 'nosetests' in os.environ.get('_', '')
try:
from settings_local import *
except ImportError:
pass
if TESTING and DEBUG:
from flask import logging as flask_logging
def mock_create_logger(app):
return logging.getLogger(app.logger_name)
flask_logging.create_logger = mock_create_logger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment