mirror of https://github.com/pallets/flask.git
Changed logic for debug level log settings
This commit is contained in:
parent
583c5f7935
commit
61a95196ac
2
CHANGES
2
CHANGES
|
@ -10,6 +10,8 @@ Relase date to be decided, codename to be chosen.
|
|||
|
||||
- The :func:`flask.url_for` function now can generate anchors to the
|
||||
generated links.
|
||||
- Logger now only returns the debug log setting if it was not set
|
||||
explicitly.
|
||||
|
||||
Version 0.8.1
|
||||
-------------
|
||||
|
|
|
@ -25,7 +25,9 @@ def create_logger(app):
|
|||
|
||||
class DebugLogger(Logger):
|
||||
def getEffectiveLevel(x):
|
||||
return DEBUG if app.debug else Logger.getEffectiveLevel(x)
|
||||
if x.level == 0 and app.debug:
|
||||
return DEBUG
|
||||
return Logger.getEffectiveLevel(x)
|
||||
|
||||
class DebugHandler(StreamHandler):
|
||||
def emit(x, record):
|
||||
|
|
|
@ -246,6 +246,13 @@ class LoggingTestCase(FlaskTestCase):
|
|||
else:
|
||||
self.assert_(False, 'debug log ate the exception')
|
||||
|
||||
def test_debug_log_override(self):
|
||||
app = flask.Flask(__name__)
|
||||
app.debug = True
|
||||
app.logger_name = 'flask_tests/test_debug_log_override'
|
||||
app.logger.level = 10
|
||||
self.assert_equal(app.logger.level, 10)
|
||||
|
||||
def test_exception_logging(self):
|
||||
out = StringIO()
|
||||
app = flask.Flask(__name__)
|
||||
|
|
Loading…
Reference in New Issue