package middleware

import "github.com/go-playground/pure/examples/middleware/logging-recovery"

Index

Constants

const (
	Black        ANSIEscSeq = "\x1b[30m"
	DarkGray                = "\x1b[30;1m"
	Blue                    = "\x1b[34m"
	LightBlue               = "\x1b[34;1m"
	Green                   = "\x1b[32m"
	LightGreen              = "\x1b[32;1m"
	Cyan                    = "\x1b[36m"
	LightCyan               = "\x1b[36;1m"
	Red                     = "\x1b[31m"
	LightRed                = "\x1b[31;1m"
	Magenta                 = "\x1b[35m"
	LightMagenta            = "\x1b[35;1m"
	Brown                   = "\x1b[33m"
	Yellow                  = "\x1b[33;1m"
	LightGray               = "\x1b[37m"
	White                   = "\x1b[37;1m"
	Underscore              = "\x1b[4m"
	Blink                   = "\x1b[5m"
	Inverse                 = "\x1b[7m"
	Reset                   = "\x1b[0m"
)

ANSI escape sequences NOTE: in an standard xterm terminal the light colors will appear BOLD instead of the light variant

Functions

func HandlePanic

func HandlePanic(w http.ResponseWriter, r *http.Request, trace []byte)

HandlePanic handles graceful panic by redirecting to friendly error page or rendering a friendly error page. trace passed just in case you want rendered to developer when not running in production

func LoggingAndRecovery

func LoggingAndRecovery(next http.HandlerFunc) http.HandlerFunc

LoggingAndRecovery handle HTTP request logging + recovery

Types

type ANSIEscSeq

type ANSIEscSeq string

ANSIEscSeq is a predefined ANSI escape sequence

Source Files

logging_recovery.go

Version
v1.0.0
Published
Sep 23, 2016
Platform
linux/amd64
Imports
5 packages
Last checked
26 seconds ago

Tools for package owners.