Created
May 2, 2012 09:55
-
-
Save playpauseandstop/2575634 to your computer and use it in GitHub Desktop.
Disable Flask's debug logger if testing mode enabled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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