Documentation
¶
Index ¶
- func GetLogger(ctx context.Context) *zap.Logger
- func IsStatusRequest(r *http.Request) bool
- func Recovery(next http.Handler) http.Handler
- func SetID(ctx context.Context, requestID string) context.Context
- func SetLogger(ctx context.Context, logger *zap.Logger) context.Context
- type Logger
- type RequestLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsStatusRequest ¶
IsStatusRequest checks if the request is a health check request
func Recovery ¶
Recovery is a middleware that recovers from panics, logs the panic (and a backtrace), and returns a HTTP 500 (Internal Server Error) status if possible. Recoverer prints a request ID if one is provided.
Alternatively, look at https://github.com/pressly/lg middleware pkgs.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a middleware that injects logger with request ID into the context of each request.
type RequestLogger ¶
type RequestLogger struct{}
RequestLogger is a struct for logging request
func NewRequestLogger ¶
func NewRequestLogger() *RequestLogger
NewRequestLogger creates new request logger
Click to show internal directories.
Click to hide internal directories.