correlationid

package
v0.0.0-...-f706a5d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

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 Logger

func Logger(c *gin.Context) *logrus.Entry

Logger creates a new Ginrus logger with a UUID included

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL