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(nextjs): Improve debug logging #1866

Merged
merged 5 commits into from
Oct 12, 2023
Merged

Conversation

BRKalow
Copy link
Member

@BRKalow BRKalow commented Oct 12, 2023

Description

Updates our debug logger to use individual console.log calls for each line. This is done to avoid platform log limitations per call. Along with this, I've improved the output of the logger slightly and added the relevant package versions to the log footer.

I did not add a unique ID to the output as the logs are still all logged together.

Output:

[clerk debug start: auth()]
  Headers debug, {
    "authStatus": "signed-in"
  }
  Options debug, {
    "apiKey": "",
    "secretKey": "sk_test_*********QDo",
    "apiUrl": "https://api.clerk.dev",
    "apiVersion": "v1",
    "authStatus": "signed-in"
  }
  JWT debug, <truncated>
[clerk debug end: auth()] (@clerk/nextjs=4.25.3,next=13.5.4)

fixes JS-716
fixes #1683

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/clerk-js
  • @clerk/clerk-react
  • @clerk/nextjs
  • @clerk/remix
  • @clerk/types
  • @clerk/themes
  • @clerk/localizations
  • @clerk/clerk-expo
  • @clerk/backend
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/fastify
  • @clerk/chrome-extension
  • gatsby-plugin-clerk
  • build/tooling/chore

@BRKalow BRKalow requested a review from a team as a code owner October 12, 2023 02:51
@changeset-bot
Copy link

changeset-bot bot commented Oct 12, 2023

🦋 Changeset detected

Latest commit: 27df664

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/nextjs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@octoper octoper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

Copy link
Contributor

@dimkl dimkl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☁️ I think we should add a ticket to handle the logging using a logger adapter to provide and use a default logger adapter that will handle truncating for Vercel, single-line logs, ...

packages/nextjs/src/utils/debugLogger.test.ts Outdated Show resolved Hide resolved
}

function debugLogFooter(name: string) {
return `[clerk debug end: ${name}] (@clerk/nextjs=${PACKAGE_VERSION},next=${nextPkg.version})`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@BRKalow BRKalow enabled auto-merge October 12, 2023 14:45
@BRKalow BRKalow added this pull request to the merge queue Oct 12, 2023
Merged via the queue into main with commit b72a799 Oct 12, 2023
5 checks passed
@BRKalow BRKalow deleted the brk.feat/improve-next-debug-logs branch October 12, 2023 14:53
@clerk-cookie clerk-cookie mentioned this pull request Oct 12, 2023
@clerk-cookie
Copy link
Collaborator

This PR has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@clerk clerk locked as resolved and limited conversation to collaborators Oct 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@clerk/nextjs logs are truncated on netlify
4 participants