Use a custom logger subclass that uses DEBUG level if in debug mode

This commit is contained in:
Armin Ronacher 2010-06-18 16:53:38 +02:00
parent 7083b35e6a
commit d44b127748
2 changed files with 12 additions and 5 deletions

View file

@ -718,9 +718,11 @@ class LoggingTestCase(unittest.TestCase):
def test_debug_log(self):
app = flask.Flask(__name__)
app.debug = True
@app.route('/')
def index():
app.logger.warning('the standard library is dead')
app.logger.debug('this is a debug statement')
return ''
@app.route('/exc')
@ -731,9 +733,10 @@ class LoggingTestCase(unittest.TestCase):
with catch_stderr() as err:
rv = c.get('/')
out = err.getvalue()
assert 'WARNING in flask_tests,' in out
assert 'WARNING in flask_tests [' in out
assert 'flask_tests.py' in out
assert 'the standard library is dead' in out
assert 'this is a debug statement' in out
with catch_stderr() as err:
try: