-
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
Add --name option to 'chalice logs' command #848
Conversation
Codecov Report
@@ Coverage Diff @@
## master #848 +/- ##
==========================================
+ Coverage 94.81% 95.03% +0.21%
==========================================
Files 21 21
Lines 3741 3743 +2
Branches 487 487
==========================================
+ Hits 3547 3557 +10
+ Misses 130 123 -7
+ Partials 64 63 -1
Continue to review full report at Codecov.
|
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 good. Just had a small comment/question. Otherwise 🚢
chalice/cli/__init__.py
Outdated
@@ -162,16 +162,19 @@ def delete(ctx, profile, stage): | |||
default=False, | |||
help='Controls whether or not lambda log messages are included.') | |||
@click.option('--stage', default=DEFAULT_STAGE_NAME) | |||
@click.option('-n', '--name', | |||
help='The name of the lambda function to retrieve logs from.', | |||
default='api_handler') |
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.
What are your thoughts on using chalice.constants.DEFAULT_HANDLER_NAME
instead of the hard coded string here?
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.
Yeah, good catch. I'll update before merging.
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.
Might be nice to update the docs as well in logging.rst
and mention that --name
will refer to either the actual python function name or whatever is provided by the name
kwarg.
Merged via 3ce3f79 |
Issue #, if available:
#841.
Description of changes:
Adds a
--name
option to chalice logs command. The originallogs
command was written in when there was only a single lambda function. This now adds support for all lambda functions.Example
Given this app:
After invoking the functions a few times:
The default is still for the API handler lambda so there's no change in behavior:
But you can now retrieve logs for your other lambda functions as well:
Note that the argument of
-n/--name
is the logical resource name, that isfoo
andbar
, which match thedef foo(): ...
,def bar(): ...
in theapp.py
file.