Documentation
¶
Index ¶
- Constants
- func GetDefaultLogger(serviceName, environment string, level int) *logrus.Entry
- func GetInsecureUserIDFromContext(ctx context.Context) string
- func GetLoggerFromContext(ctx context.Context) *logrus.Entry
- func GetRequestIDFromContext(ctx context.Context) string
- func HandlerFunc(h func(w http.ResponseWriter, r *http.Request) error) http.Handler
- func NoCache(h http.Handler) http.Handler
- func Recovery(h http.Handler) http.Handler
- func RequestID(h http.Handler) http.Handler
- type JWTDecoder
- type Logger
- type Timer
- type UserIDIngector
Constants ¶
View Source
const (
HeaderRequestID = "x-request-id"
)
Variables ¶
This section is empty.
Functions ¶
func GetDefaultLogger ¶
GetDefaultLogger gets a default logger to use. level is a number from 0-7, 0 being the most strict and 7 the most verbose
func GetInsecureUserIDFromContext ¶
getInsecureUserIDFromContext returns the user id or empty string if missing
func GetLoggerFromContext ¶
GetLoggerFromContext returns a logrus entry from the context, defaulting to a standard one if its not found
func GetRequestIDFromContext ¶
GetRequestIDFromContext returns the requestID or empty string if missing
func HandlerFunc ¶
HandlerFunc converts a handler with an error to a standard handler
Types ¶
type JWTDecoder ¶
type Timer ¶
type Timer interface {
Time(name string) alice.Constructor
}
Timer can time a handler and log it
func NewNullTimer ¶
func NewNullTimer() Timer
type UserIDIngector ¶
UserIDIngector injects a UserID from a JWT into the context
func NewUserIDInjector ¶
func NewUserIDInjector(jwt JWTDecoder) UserIDIngector
NewLogrusLogger allows you to setup a base entry to use for logging
Source Files
¶
Click to show internal directories.
Click to hide internal directories.