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(logger):color latency #4146

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

feat(logger):color latency #4146

wants to merge 1 commit into from

Conversation

wsyqn6
Copy link

@wsyqn6 wsyqn6 commented Jan 23, 2025

add colored latency to log output based on latency thresholds

Summary

This PR introduces a new function LatencyColor in the logger middleware of the Gin framework. This function assigns colors to log output based on the request latency, improving the readability and visual identification of performance bottlenecks.

Motivation

The current logging system outputs latency as plain text, making it difficult to quickly identify performance issues at a glance. By adding color-coded latency information, developers can more easily distinguish between different latency levels, aiding in faster debugging and performance monitoring.

Changes

  1. Add LatencyColor Function: Implement a function that returns a color string based on the request latency.

image

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.

1 participant