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

Allow custom log function to be provided #25

Closed
Limess opened this issue Jul 29, 2019 · 2 comments · Fixed by #59
Closed

Allow custom log function to be provided #25

Limess opened this issue Jul 29, 2019 · 2 comments · Fixed by #59
Labels

Comments

@Limess
Copy link

Limess commented Jul 29, 2019

Currently this library logs using console methods.

We're using structured logging in JSON using a library (Pino but that's not relevant here) in all of our applications, including AWS Lambda functions. Using this library currently results in unstructured log statements in our log aggregation which makes queries difficult.

I'd suggest adding a logger parameter to an options object and then calling that instead of console, defaulting to console if none is provided.

e.g.

serverless(handler, {logger});

where logger has the same interface as console.

@gr2m
Copy link
Contributor

gr2m commented Feb 9, 2021

This will be possible via #59

const { createLambdaFunction, createProbot } = require("@probot/adapter-aws-lambda-serverless");
const appFn = require("./");

module.exports.webhooks = createLambdaFunction(appFn, {
  probot: createProbot({
    defaults: { 
      log: logger
    }
  })
});

Also with Probot v11, Probot itself is using pino, too :) We created a custom transport: https://github.com/probot/pino/

GitHub
🛠️ formatting and error captioning for probot logs - probot/pino

@gr2m gr2m mentioned this issue Feb 9, 2021
@gr2m gr2m closed this as completed in #59 Feb 10, 2021
@github-actions
Copy link

🎉 This issue has been resolved in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants