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

Make it possible to override the whatever is being consolelogged #115

wants to merge 1 commit into from


Copy link

commented May 31, 2019


We're forwarding CloudWatch logs to a Kinesis, but only if they have a specific prefix in front to the JSON blob.

In order to forward the JSON entries from our lambda-api app we need to be able to customize how the console.log method is called.


This PR provides a rudimentary customizability for adjusting the final log output, like so:

const api = require('lambda-api')()
// Overwrite the original method
api._consoleLog = (...logLine) => console.log('customStringForTaggingCertainLogOutputs ', ...logLine)

Resulting in log entries like so:

customStringForTaggingCertainLogOutputs {
    "level": "access",
    "route": "/foo",
    "method": "GET"

Please let me know if there is something I can do to help get this approved :)


This comment has been minimized.

Copy link

commented May 31, 2019

Pull Request Test Coverage Report for Build 242

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.0003%) to 99.684%

Totals Coverage Status
Change from base Build 237: 0.0003%
Covered Lines: 585
Relevant Lines: 586

💛 - Coveralls

This comment has been minimized.

Copy link

commented May 31, 2019

Thanks, @Sleavely! I like this idea.

I'm working on some improvements to the logging, so I will definitely incorporate this. I can possibly release this as a patch as well. Just need to check for compatibility.



This comment has been minimized.

Copy link

commented Aug 1, 2019

I've incorporated a version into this into the logger configuration. This should address your use case.

@jeremydaly jeremydaly closed this Aug 1, 2019

jeremydaly added a commit that referenced this pull request Aug 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.