Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix log level out of sync with debug mode #446

Merged
merged 1 commit into from
Jul 31, 2017

Conversation

stealthycoin
Copy link
Contributor

Debug mode can be set with app.debug = True which does not update
the logger level from ERROR to DEBUG. This is has been replaced with a
setter that reconfigures the log level after debug is reset. The
initialization method on the Chalice class had some logic that checked
what the debug value was and configured the logger to match; however,
debug was hardcoded to be False so this never did anything useful. A
debug parameter has been added to the the init method to make this
more useful, it defaults to False.

fixes #386
cc @jamesls @kyleknap

@stealthycoin stealthycoin requested review from jamesls and kyleknap July 31, 2017 17:06
Copy link
Contributor

@kyleknap kyleknap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine. Just had a small question.

@@ -418,12 +418,12 @@ class Chalice(object):

FORMAT_STRING = '%(name)s - %(levelname)s - %(message)s'

def __init__(self, app_name, configure_logs=True, env=None):
def __init__(self, app_name, debug=False, configure_logs=True, env=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to put this argument at the end just in case users are providing these options as positional arguments?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preference given we're pre GA is to order them based on frequent usage and I would expect debug to be more common than the other options. So I vote to keep it as is.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright that's fine with me. Just wanted to make sure people were aware of it.

Copy link
Contributor

@kyleknap kyleknap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

Debug mode can be set with `app.debug = True` which does not update
the logger level from ERROR to DEBUG. This is has been replaced with a
setter that reconfigures the log level after debug is reset. The
initialization method on the Chalice class had some logic that checked
what the debug value was and configured the logger to match; however,
debug was hardcoded to be False so this never did anything useful. A
debug parameter has been added to the the __init__ method to make this
more useful, it defaults to False to be the same as the hardcoded value.

fixes aws#386
@stealthycoin stealthycoin force-pushed the fix-debug-mode-log-level branch from ff20f8a to 71f153a Compare July 31, 2017 21:38
@stealthycoin stealthycoin merged commit c154ed2 into aws:master Jul 31, 2017
@stealthycoin stealthycoin deleted the fix-debug-mode-log-level branch July 31, 2017 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting app.debug does not propagate to app.log logger log level
4 participants