Documentation ¶
Overview ¶
Package zaphelpers provides several helpers for the usage with zap.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext extracts a logger from the context, if it's injected there. Otherwise, a no-op logger is returned.
Types ¶
type HTTPMiddleware ¶
HTTPMiddleware defines the type for the usual net/http middleware.
func InjectLogger ¶
func InjectLogger(logger *zap.Logger) HTTPMiddleware
InjectLogger returns a middleware that injects the given logger into each request.
func RequestLogger ¶
func RequestLogger() HTTPMiddleware
RequestLogger logs each HTTP request. It should be added to the middleware stack after InjectLogger.
Click to show internal directories.
Click to hide internal directories.