apiserver: k8s.io/apiserver/pkg/server/httplog Index | Files

package httplog

import "k8s.io/apiserver/pkg/server/httplog"

Package httplog contains a helper object and functions to maintain a log along with an http response.


Package Files

doc.go httplog.go

func DefaultStacktracePred Uses

func DefaultStacktracePred(status int) bool

DefaultStacktracePred is the default implementation of StacktracePred.

func LogOf Uses

func LogOf(req *http.Request, w http.ResponseWriter) logger

LogOf returns the logger hiding in w. If there is not an existing logger then a passthroughLogger will be created which will log to stdout immediately when Addf is called.

func Unlogged Uses

func Unlogged(req *http.Request, w http.ResponseWriter) http.ResponseWriter

Unlogged returns the original ResponseWriter, or w if it is not our inserted logger.

func WithLogging Uses

func WithLogging(handler http.Handler, pred StacktracePred) http.Handler

WithLogging wraps the handler with logging.

type StacktracePred Uses

type StacktracePred func(httpStatus int) (logStacktrace bool)

StacktracePred returns true if a stacktrace should be logged for this status.

func StatusIsNot Uses

func StatusIsNot(statuses ...int) StacktracePred

StatusIsNot returns a StacktracePred which will cause stacktraces to be logged for any status *not* in the given list.

Package httplog imports 8 packages (graph) and is imported by 16 packages. Updated 2020-05-27. Refresh now. Tools for package owners.