Documentation ¶
Overview ¶
Package correlationid adds a request correlation UUID to the request context, and includes an optional RequestLogger middleware including the UUID in all request log statements.
Index ¶
Constants ¶
View Source
const ( CorrelationHeader = "X-Correlation-ID" LogKey = "log" ContextKey = "uuid" )
CorrelationHeader defines a default Correlation ID HTTP header.
Variables ¶
This section is empty.
Functions ¶
func RequestLogger ¶
func RequestLogger(timeFormat string, utc bool) gin.HandlerFunc
RequestLogger is a port of the Ginrus middleware from gin-gonic/contrib, but will include the request uuid as well.
func SetRequestUUID ¶
func SetRequestUUID(correlationHeader string) gin.HandlerFunc
SetRequestUUID will search for a correlation header and set a request-level correlation ID into the net.Context. If no header is found, a new UUID will be generated.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.