andrew-templeton / cfn-lambda

CloudFormation custom resource helper for Lambda Node.js runtime
MIT License
82 stars 22 forks source link

Ability to control logging behavior #46

Open erezrokah opened 5 years ago

erezrokah commented 5 years ago

I've created a CircleCI custom resource using this library and it works pretty well, thank you :)

The only issue I have is that the library logs the event including the ApiToken property I pass to the custom resource. I would like to avoid logging sensitive data, or at least sanitize it.

I can probably monkey patch console.log but that seems very ugly.

I can create a pull request for this issue my self, but would like to decide first on a solution. Possible solutions:

  1. Ability to pass in a logger as an option.
  2. Ability to pass log level as an option (also to disable library logging all together).
  3. Ability to pass in a sanitize method.
  4. Normalize the library logs with a common prefix to easily identify log messages.

I think a combination of 1+4 would probably cover most use cases.