package
0.0.1
Repository: https://github.com/volatiletech/abcweb.git
Documentation: pkg.go.dev

# README

ABCMiddleware

License GoDoc Go Report Card

Available Middleware

  • Zap - Zap middleware handles web request logging using Zap
  • Recover - Recover middleware recovers panics that occur and gracefully logs their error

See GoDoc for API usage.

# Functions

Logger returns the Request ID scoped logger from the request Context and panics if it cannot be found.
LoggerCTX retrieves a logger from a context.
NewError creates a new ErrorContainer that can be added to an errorManager.
NewErrorManager creates an error manager that can be used to create an error handler to wrap your controllers with.
RequestIDHeader sets the X-Request-ID header to the chi request id This must be used after the chi request id middleware.
ZapLog returns a logging middleware that outputs details about a request.
ZapRecover will attempt to log a panic, as well as produce a reasonable error for the client by calling the passed in errorHandler function.
ZapRequestIDLogger returns a request id logger middleware.

# Constants

CTXKeyLogger is the key under which the request scoped logger is placed.

# Variables

These are the errors that can be used in your controllers and matched against in the Errors middleware to perform special actions.
These are the errors that can be used in your controllers and matched against in the Errors middleware to perform special actions.

# Structs

ErrorContainer holds all of the relevant variables for a users custom error.
ErrorManager helps manage errors at the application level.

# Interfaces

MW is an interface defining middleware wrapping.

# Type aliases

AppHandler is the function signature for controllers that return errors.
ErrorHandler is the function signature for user supplied error handlers.
MiddlewareFunc is the function signature for Chi's Use() middleware.