Documentation ¶
Index ¶
Constants ¶
View Source
const XRequestID = "X-Request-Id"
Variables ¶
View Source
var NoopTags = &noopTags{}
NoopTags is a trivial, minimum overhead implementation of Tags for which all operations are no-ops.
Functions ¶
func CtxTags ¶
func CtxTags(opts ...Option) gin.HandlerFunc
Types ¶
type Option ¶
type Option func(*options)
func WithFieldExtractor ¶
func WithFieldExtractor(f RequestFieldExtractorFunc) Option
WithFieldExtractor customizes the function for extracting log fields from protobuf messages, for unary and server-streamed methods only.
type RequestFieldExtractorFunc ¶
RequestFieldExtractorFunc is a user-provided function that extracts field information from a http request. It is called from tags middleware on arrival of request. Keys and values will be added to the context tags. If there are no fields, you should return a nil.
type Tags ¶
type Tags interface { // Set sets the given key in the metadata tags. Set(key string, value interface{}) Tags // Has checks if the given key exists. Has(key string) bool // Values returns a map of key to values. // Do not modify the underlying map, please use Set instead. Values() map[string]interface{} }
Tags is the interface used for storing request tags between Context calls. The default implementation is *not* thread safe, and should be handled only in the context of the request.
func FromContext ¶
Click to show internal directories.
Click to hide internal directories.