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

Add FAQ to README.md #116

Merged
merged 2 commits into from
Apr 4, 2023
Merged

Add FAQ to README.md #116

merged 2 commits into from
Apr 4, 2023

Conversation

bahlo
Copy link
Member

@bahlo bahlo commented Apr 3, 2023

No description provided.

@bahlo bahlo requested a review from schehata April 3, 2023 12:32
@vercel
Copy link

vercel bot commented Apr 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-axiom-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2023 0:33am

Copy link
Member

@dominicchapman dominicchapman left a comment

Choose a reason for hiding this comment

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

nice one @bahlo!

qq, what’s the inspiration for the .with() pattern versus log({}) directly?

@schehata
Copy link
Collaborator

schehata commented Apr 3, 2023

nice one @bahlo!

qq, what’s the inspiration for the .with() pattern versus log({}) directly?

.with({userId: 44522}) creates a sublogger that will attach the passed args to every log, instead of the need to attach it to every log manully, for example:

const logWithUser = log.with({userId: 1234, projectId: 5412})
logWithUser.info('hi')
logWithUser.warn('again')
logWithUser.error('oh I made an error')

will result in :

{level: 'info', message: 'hi', fields: {userId: 1234, projectId: 5412}}
{level: 'warn', message: 'again', fields: {userId: 1234, projectId: 5412}}
{level: 'error', message: 'oh I made an error', fields: {userId: 1234, projectId: 5412}}

to achieve the same thing without with() you would have to keep repeating the userId, like:

log.info('hi', {userId: 1234, projectId: 5412})
log.warn('again', {userId: 1234, projectId: 5412})
log.error('oh I made an error', {userId: 1234, projectId: 5412})

@schehata schehata merged commit 30fc96a into main Apr 4, 2023
7 checks passed
@schehata schehata deleted the arne/add-faq branch April 4, 2023 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants