rzhttp

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package rzhttp provides an helper middleware to log HTTP requests See https://github.com/bloom42/rz-go/tree/master/examples/http for a working example

Index

Constants

View Source
const RequestIDCtxKey ctxKeyRequestID = 0

RequestIDCtxKey is the key that holds the unique request ID in a request context.

Variables

This section is empty.

Functions

func Handler

func Handler(logger rz.Logger, options ...HandlerOption) func(next http.Handler) http.Handler

Handler is a helper middleware to log HTTP requests

Types

type HandlerOption

type HandlerOption func(*httpHandler)

HandlerOption are used to configure a HTTPHandler.

func Duration

func Duration(durationFieldName string) HandlerOption

Duration is used to updated HTTPHandler's duration field name. Set an empty string to disable the field.

func Host

func Host(hostFieldName string) HandlerOption

Host is used to updated HTTPHandler's host field name. Set an empty string to disable the field.

func Message

func Message(message string) HandlerOption

Message is used to updated HTTPHandler's message field name. Set an empty string to disable it.

func Method

func Method(methodFieldName string) HandlerOption

Method is used to updated HTTPHandler's method field name. Set an empty string to disable the field.

func RemoteAddress

func RemoteAddress(remoteAddressFieldName string) HandlerOption

RemoteAddress is used to updated HTTPHandler's remote address field name. Set an empty string to disable the field.

func RequestID

func RequestID(requestIDFieldName string) HandlerOption

RequestID is used to updated HTTPHandler's request ID field name. Set an empty string to disable the field.

func Scheme

func Scheme(schemeFieldName string) HandlerOption

Scheme is used to updated HTTPHandler's scheme field name. Set an empty string to disable the field.

func Size

func Size(sizeFieldName string) HandlerOption

Size is used to updated HTTPHandler's size field name. Set an empty string to disable the field.

func Status

func Status(statusFieldName string) HandlerOption

Status is used to updated HTTPHandler's status field name. Set an empty string to disable the field.

func URL

func URL(urlFieldName string) HandlerOption

URL is used to updated HTTPHandler's url field name. Set an empty string to disable the field.

func UserAgent

func UserAgent(userAgentFieldName string) HandlerOption

UserAgent is used to updated HTTPHandler's user agent field name. Set an empty string to disable the field.

Jump to

Keyboard shortcuts

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