Test_CustomTags() — fiber Function Reference
Architecture documentation for the Test_CustomTags() function in logger_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD de6e5ca3_c39c_de69_8963_30c587e34e39["Test_CustomTags()"] 97b45bc9_01a3_2a9a_4c94_9de1344ca94c["logger_test.go"] de6e5ca3_c39c_de69_8963_30c587e34e39 -->|defined in| 97b45bc9_01a3_2a9a_4c94_9de1344ca94c style de6e5ca3_c39c_de69_8963_30c587e34e39 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/logger/logger_test.go lines 922–950
func Test_CustomTags(t *testing.T) {
t.Parallel()
customTag := "it is a custom tag"
buf := bytebufferpool.Get()
defer bytebufferpool.Put(buf)
app := fiber.New()
app.Use(New(Config{
Format: "${custom_tag}",
CustomTags: map[string]LogFunc{
"custom_tag": func(output Buffer, _ fiber.Ctx, _ *Data, _ string) (int, error) {
return output.WriteString(customTag)
},
},
Stream: buf,
}))
app.Get("/", func(c fiber.Ctx) error {
return c.SendString("Hello fiber!")
})
reqHeaderReq := httptest.NewRequest(fiber.MethodGet, "/", http.NoBody)
reqHeaderReq.Header.Add("test", "Hello fiber!")
resp, err := app.Test(reqHeaderReq)
require.NoError(t, err)
require.Equal(t, fiber.StatusOK, resp.StatusCode)
require.Equal(t, customTag, buf.String())
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_CustomTags() do?
Test_CustomTags() is a function in the fiber codebase, defined in middleware/logger/logger_test.go.
Where is Test_CustomTags() defined?
Test_CustomTags() is defined in middleware/logger/logger_test.go at line 922.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free