httplog

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CorrelationIDFromRequest

func CorrelationIDFromRequest(r *http.Request) string

CorrelationIDFromRequest returns the correlation ID associated with a http.Request

Types

type HTTPLog

type HTTPLog struct {
	LogOut     Logger
	ServerName string
	LogName    string
	SkipInfo   bool

	CorrelationHeader string
}

HTTPLog is a simple logging middleware that can be added to the net/http server. It supports basic request correlation.

func (*HTTPLog) GetHandler

func (l *HTTPLog) GetHandler(next http.Handler) http.Handler

GetHandler returns a function that goes in between the server and the real handler

type Logger

type Logger func(string, ...interface{})

Logger is a function that can be used for logging. It has the same signature as log.Printf

func LogfFromRequest

func LogfFromRequest(r *http.Request) Logger

LogfFromRequest returns a function with fmt.Printf signature that will write to the log associated with the request

Jump to

Keyboard shortcuts

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