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

feat(logger): introduce user configurable logger #1294

Merged
merged 6 commits into from
Feb 11, 2021

Conversation

balazsorban44
Copy link
Member

@balazsorban44 balazsorban44 commented Feb 10, 2021

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, called logger.

It has three properties, error, warn and debug. 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:

  • Documentation
  • Tests (locally)
  • Ready to be merged

closes #869
closes #907

continuation of #870, #1090 (cannot git 🙈)

@vercel
Copy link

vercel bot commented Feb 10, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nextauthjs/next-auth/2bw7uq44z
✅ Preview: https://next-auth-git-feature-improve-logging.nextauthjs.vercel.app

@github-actions github-actions bot added the docs Relates to documentation label Feb 10, 2021
@balazsorban44 balazsorban44 changed the title feat(logger): add user configurable logger feat(logger): introduce user configurable logger Feb 10, 2021
@vercel vercel bot temporarily deployed to Preview February 10, 2021 18:37 Inactive
@github-actions github-actions bot added the adapters Changes related to the core code concerning database adapters label Feb 10, 2021
Copy link
Member

@ndom91 ndom91 left a 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 👍

@balazsorban44 balazsorban44 merged commit 82dd6ba into main Feb 11, 2021
@balazsorban44 balazsorban44 deleted the feature/improve-logging branch February 11, 2021 13:50
@github-actions
Copy link

🎉 This PR is included in version 3.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

mnphpexpert added a commit to mnphpexpert/next-auth that referenced this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters Changes related to the core code concerning database adapters docs Relates to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurable logging
3 participants