-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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(logger): introduce user configurable logger #1294
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/nextauthjs/next-auth/2bw7uq44z |
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.
This looks awesome! Good docs example as well 👍
🎉 This PR is included in version 3.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What:
Let the user configure logging.
Why:
This lets the user override certain log levels, in case they would like to forward the log messages to something else than
console
.How:
Adds a new option to
NextAuth
, calledlogger
.It has three properties,
error
,warn
anddebug
. Those not overridden will fall back to the basic logger function.To cover client-side logs, we do make the assumption that your 3rd party logger does not support client-side logging. To mitigate this, we proxy all client-side log events to an endpoint (
/api/auth/_log
) that sends those further to your custom logger config.We use
sendBeacon
if available.Checklist:
closes #869
closes #907
continuation of #870, #1090 (cannot git 🙈)