koaMiddleware

package
v2.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

* * @Author: TheLife * @Date: 2021/5/10 上午11:48

Index

Constants

This section is empty.

Variables

View Source
var DefaultErrorWriter io.Writer = os.Stderr

Functions

func NewLoggerMiddleware

func NewLoggerMiddleware(isStdout, isWriter bool, serviceName string, writerDir string) (koa.HandlerFunc, error)

func NewLoggerMiddlewareSmoothFail

func NewLoggerMiddlewareSmoothFail(isStdout, isWriter bool, serviceName string, writerDir string) koa.HandlerFunc

func Recovery

func Recovery() koa.HandlerFunc

Recovery returns a middleware that recovers from any panics and writes a 500 if there was one.

func RecoveryWithWriter

func RecoveryWithWriter(out io.Writer) koa.HandlerFunc

RecoveryWithWriter returns a middleware for a given writer that recovers from any panics and writes a 500 if there was one.

Types

type LogFormatterParams

type LogFormatterParams struct {
	TimeStamp   time.Time `json:"time"`
	ServiceName string    `json:"service_name"`
	Result      koa.Data  `json:"result"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL