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

Fix: logger color output #2296

Merged
merged 1 commit into from
Jan 14, 2023
Merged

Fix: logger color output #2296

merged 1 commit into from
Jan 14, 2023

Conversation

cloudwindy
Copy link
Contributor

@cloudwindy cloudwindy commented Jan 14, 2023

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Explain the details for making this change. What existing problem does the pull request solve?

Fixes logger color output

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • For new functionalities I follow the inspiration of the express js framework and built them similar in usage
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation - https:/gofiber/docs for https://docs.gofiber.io/
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • If new dependencies exist, I have checked that they are really necessary and agreed with the maintainers/community (we want to have as few dependencies as possible)
  • I tried to make my code as fast as possible with as few allocations as possible
  • For new code I have written benchmarks so that they can be analyzed and improved

Commit formatting:

Use emojis on commit messages so it provides an easy way of identifying the purpose or intention of a commit. Check out the emoji cheatsheet here: https://gitmoji.carloscuesta.me/

@welcome
Copy link

welcome bot commented Jan 14, 2023

Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

Copy link
Member

@ReneWerner87 ReneWerner87 left a comment

Choose a reason for hiding this comment

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

Do not think that this change fixes a problem
Since I can also unfortunately not get any details from the description

@cloudwindy
Copy link
Contributor Author

This fixes the problem that because of the following code, the logger middleware does not show colored output in any cases.

if cfg.Output == nil {
	cfg.Output = ConfigDefault.Output
}

// Enable colors if no custom format or output is given
if cfg.Output == nil && checkColorEnable(cfg.Format) {
	cfg.enableColors = true
}

Since cfg.Output will be ConfigDefault.Output in case of it is nil, it does not enable colors.

@ReneWerner87
Copy link
Member

ReneWerner87 commented Jan 14, 2023

Okay I see, we will see if the output writer is the default one

@li-jin-gou
Copy link
Contributor

lgtm

@li-jin-gou li-jin-gou merged commit 0628b95 into gofiber:master Jan 14, 2023
@welcome
Copy link

welcome bot commented Jan 14, 2023

Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants