Documentation
¶
Index ¶
Constants ¶
View Source
const RESPONSE_BODY_LOG_LIMIT = 1000
Maximum number of bytes of response body which will be logged.
Variables ¶
This section is empty.
Functions ¶
func LogMiddleware ¶
LogMiddleware adds a logging middleware to an http.Handler. For each HTTP request the middleware will log via plog.CtxPlog(req.Context()).OpenDict("http-in"). When the handler is called it's with a "log" sub-context to that plog context.
The infoLogger and errorLogger arguments are deprecated but if non-nil those functions will be called with information about the request. infoLogger is called on 1xx, 2xx, 3xx requests, errorLogger is called otherwise. This is done in addition to the direct logging.
If h is nil then http.DefaultServeMux is used.
Types ¶
Click to show internal directories.
Click to hide internal directories.