TestColorForLatency() — gin Function Reference
Architecture documentation for the TestColorForLatency() function in logger_test.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD eadffed2_afd8_9d1c_39b9_359af96c2e72["TestColorForLatency()"] 9089ba1c_3991_2941_2a87_9934a9e12a6a["logger_test.go"] eadffed2_afd8_9d1c_39b9_359af96c2e72 -->|defined in| 9089ba1c_3991_2941_2a87_9934a9e12a6a style eadffed2_afd8_9d1c_39b9_359af96c2e72 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
logger_test.go lines 320–335
func TestColorForLatency(t *testing.T) {
colorForLantency := func(latency time.Duration) string {
p := LogFormatterParams{
Latency: latency,
}
return p.LatencyColor()
}
assert.Equal(t, white, colorForLantency(time.Duration(0)), "0 should be white")
assert.Equal(t, white, colorForLantency(time.Millisecond*20), "20ms should be white")
assert.Equal(t, green, colorForLantency(time.Millisecond*150), "150ms should be green")
assert.Equal(t, cyan, colorForLantency(time.Millisecond*250), "250ms should be cyan")
assert.Equal(t, yellow, colorForLantency(time.Millisecond*600), "600ms should be yellow")
assert.Equal(t, magenta, colorForLantency(time.Millisecond*1500), "1.5s should be magenta")
assert.Equal(t, red, colorForLantency(time.Second*3), "other things should be red")
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does TestColorForLatency() do?
TestColorForLatency() is a function in the gin codebase, defined in logger_test.go.
Where is TestColorForLatency() defined?
TestColorForLatency() is defined in logger_test.go at line 320.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free