MCPcopy Create free account
hub / github.com/BryanMwangi/pine / requestLogger

Function requestLogger

Examples/GroupExample/main.go:54–61  ·  view source on GitHub ↗

requestLogger is a middleware that logs each request method and path. It runs for every route registered on the group it is attached to.

()

Source from the content-addressed store, hash-verified

52// requestLogger is a middleware that logs each request method and path.
53// It runs for every route registered on the group it is attached to.
54func requestLogger() pine.Middleware {
55 return func(next pine.Handler) pine.Handler {
56 return func(c *pine.Ctx) error {
57 log.Printf("%s %s", c.Method, c.BaseURI)
58 return next(c)
59 }
60 }
61}
62
63// requireAPIKey checks for a valid X-API-Key header.
64// Attach it to a group to gate an entire sub-tree without touching each handler.

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected