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: ensure prefix tag always display in createLogger #17603

Closed
wants to merge 8 commits into from

Conversation

vctqs1
Copy link

@vctqs1 vctqs1 commented Jul 2, 2024

Description

Fixes #17604

The changes include:

  • Moved the tag assignment outside of the if (options.timestamp) block for better clarity.
  • Ensured that the tag is always included in the log message, regardless of whether a timestamp is present.

For now, when logging without timestamp=true

const logger = createLogger('info', {
  prefix: '[prefix]'
})

logger.info('message', { timestamp: false })

The prefix tag was not shown. This update ensures the prefix tag is always displayed.

Copy link

stackblitz bot commented Jul 2, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@vctqs1 vctqs1 changed the title [Feat] Ensure prefix tag always display in createLogger [feat] Ensure prefix tag always display in createLogger Jul 2, 2024
@vctqs1 vctqs1 marked this pull request as ready for review July 2, 2024 13:06
@vctqs1 vctqs1 changed the title [feat] Ensure prefix tag always display in createLogger feat: ensure prefix tag always display in createLogger Jul 2, 2024
@vctqs1
Copy link
Author

vctqs1 commented Jul 2, 2024

looks like a flaky test fail. it's not related to this change.

@vctqs1
Copy link
Author

vctqs1 commented Jul 4, 2024

@patak-dev the CI is passed now, could you help review this PR again

@patak-dev
Copy link
Member

We use the logger with a vite prefix for normal messages. We can't do this change or we will break the CLI output. With this PR, this is how running pnpm run dev would look like:
image

The tag is intended to be used only to help while debugging, and as part of a timestamped message.

@vctqs1
Copy link
Author

vctqs1 commented Jul 9, 2024

@patak-dev Thanks for replying me, I got it. so let me close this PR

@vctqs1 vctqs1 closed this Jul 9, 2024
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.

[feat] Ensure prefix tag always display in createLogger
2 participants