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(middleware/logger): latency match gin-gonic/gin formatter #2569

Merged
merged 3 commits into from
Aug 11, 2023

Conversation

sixcolors
Copy link
Member

@sixcolors sixcolors commented Aug 10, 2023

Description

TagLatency to match gin-gonic/gin defaultLogFormatter, specifically %13v instead of %7v.

With %7v:

| 4.834µs |
| 1.136834ms |
| 1.000066333s |

With %13v, like gin https://github.com/gin-gonic/gin/blob/62b50cfbc0de877207ff74c160a23dff6394f563/logger.go#L143:

|       4.333µs |
|    1.133916ms |
|  1.000057458s |

And, adds Test_Logger_WithLatency, which proves that the logger would show he smallest unit that makes sense. (except for ns, which is probably too fast for most systems to test).

Fixes #2561

Type of change

Please delete options that are not relevant.

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

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • 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
  • I tried to make my code as fast as possible with as few allocations as possible

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/

@sixcolors sixcolors requested a review from gaby August 10, 2023 19:07
@sixcolors sixcolors changed the title 🚀 chore: logger latency match gin-gonic/gin formatter 💄 chore: logger latency match gin-gonic/gin formatter Aug 10, 2023
@sixcolors sixcolors changed the title 💄 chore: logger latency match gin-gonic/gin formatter 💄 feat: logger latency match gin-gonic/gin formatter Aug 10, 2023
@sixcolors sixcolors changed the title 💄 feat: logger latency match gin-gonic/gin formatter 💄 feat(middleware/logger): latency match gin-gonic/gin formatter Aug 10, 2023
Copy link
Member

@gaby gaby left a comment

Choose a reason for hiding this comment

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

lgtm

@sixcolors sixcolors merged commit 2624c5d into gofiber:master Aug 11, 2023
16 of 17 checks passed
@sixcolors sixcolors deleted the 2258-logger-latency branch August 11, 2023 00:13
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.

🚀 [Feature]: Log show lowerst time-unit that makes sense [#2258]
3 participants