-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix log level out of sync with debug mode #446
Conversation
There was a problem hiding this 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): |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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
ff20f8a
to
71f153a
Compare
Debug mode can be set with
app.debug = True
which does not updatethe 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