MCPcopy
hub / github.com/rs/zerolog / IDFromRequest

Function IDFromRequest

hlog/hlog.go:187–192  ·  view source on GitHub ↗

IDFromRequest returns the unique id associated to the request if any.

(r *http.Request)

Source from the content-addressed store, hash-verified

185
186// IDFromRequest returns the unique id associated to the request if any.
187func IDFromRequest(r *http.Request) (id xid.ID, ok bool) {
188 if r == nil {
189 return
190 }
191 return IDFromCtx(r.Context())
192}
193
194// IDFromCtx returns the unique id associated to the context if any.
195func IDFromCtx(ctx context.Context) (id xid.ID, ok bool) {

Callers 2

RequestIDHandlerFunction · 0.85
TestRequestIDHandlerFunction · 0.85

Calls 1

IDFromCtxFunction · 0.85

Tested by 1

TestRequestIDHandlerFunction · 0.68