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

feat(log): Log AWS SDK calls in debug mode #5604

Merged
merged 1 commit into from Dec 19, 2018

Conversation

Projects
None yet
4 participants
@jlamande
Copy link
Contributor

jlamande commented Dec 16, 2018

What did you implement:

Logging AWS SDK calls when SLS_DEBUG is activated.

Closes #5603

How did you implement it:

Configure the AWS.config.logger when SLS_DEBUG environment is activated.
In that case the AWS.config.logger will simply use the serverless.cli.log function to log AWS SDK calls.

Based on the official AWS documentation for logging :
https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/logging-sdk-calls.html

How can we verify it:

In any serverless projects :

SLS_DEBUG=true serverless deploy

The console output should show the AWS SDK calls made by serverless :

...
Serverless: Invoke aws:deploy:deploy
Serverless: [AWS cloudformation 200 0.653s 0 retries] describeStacks({ StackName: 'aws-nodejs-dev' })
Serverless: [AWS cloudformation 200 0.416s 0 retries] describeStackResource({ StackName: 'aws-nodejs-dev',
  LogicalResourceId: 'ServerlessDeploymentBucket' })
Serverless: Uploading CloudFormation file to S3...
Serverless: [AWS s3 200 0.539s 0 retries] putObject({ Body:
   <Buffer 7b 22 41 57 53 54 65 6d 70 6c 61 74 65 46 6f 72 6d 61 74 56 65 72 73 69 6f 6e 22 3a 22 32 30 31 30 2d 30 39 2d 30 39 22 2c 22 44 65 73 63 72 69 70 74 ... 2008 more bytes>,
  Bucket: 'aws-nodejs-dev-serverlessdeploymentbucket-1xxxx1l3xgitw',
  Key:
   'serverless/aws-nodejs/dev/1544952584628-2018-12-16T09:29:44.628Z/compiled-cloudformation-template.json',
  ContentType: 'application/json',
  Metadata:
   { filesha256: 'xZIKLb/bwT/oy2xNWi6mYZmtWIag3ummNB7fzfIiplU=' } })
Serverless: Uploading artifacts...
...

Todos:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

@jlamande jlamande changed the title feat(5603): Log AWS SDK calls in debug mode feat(log): Log AWS SDK calls in debug mode Dec 18, 2018

@jlamande jlamande force-pushed the jlamande:feat-5603 branch from dd836e8 to 14c8af8 Dec 18, 2018

@horike37
Copy link
Member

horike37 left a comment

@jlamande
Nice! I like this feature. LGTM 👍

@dschep

This comment has been minimized.

Copy link
Member

dschep commented Dec 19, 2018

I like it too! :shipit:

@dschep dschep merged commit 59e31b1 into serverless:master Dec 19, 2018

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.004%) to 90.781%
Details

dschep added a commit that referenced this pull request Jan 9, 2019

v1.36.0 release!
 - [Log AWS SDK calls in debug mode](#5604)
 - [Added currently supported regions for GCP functions](#5601)
 - [Update Cloudflare Templates](#5620)
 - [AWS: Validate rate/cron syntax before Deploy](#5635)
 - [Fix error log output](#5378)
 - [Support for native async/await in AWS Lambda for aws-nodejs-typescript template ](#5607)
 - [aws-csharp create template uses handler-specific artifact](#5411)
 - [change behaviour on initial stack create failed](#5631)
 - [Add warning for multiple functions having same handler](#5638)
 - [AWS: Add API Gateway stage name validation.](#5639)

@dschep dschep referenced this pull request Jan 9, 2019

Merged

v1.36.0 release! #5670

@shortjared shortjared added this to the 1.36.0 milestone Jan 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment