Documentation
¶
Overview ¶
Pacakge trace implements a trace logging HTTP request middleware handler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTraceID ¶
GetTraceID returns the trace ID from ctx.
func NewTraceLoggingHandler ¶
func NewTraceLoggingHandler(next http.Handler, logger log.Logger, traceIDFn func(*http.Request) string) http.HandlerFunc
NewTraceLoggingHandler logs HTTP request details and sets up trace logging. The host, method, URL path, user agent are immediately logged. The "x_forwarded_for" header is also logged if present. The "trace_id" key will be set on the context logger and logged if traceIDFn is set.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.