Back to godoc.org
github.com/GameWith/eglm

Package eglm

v1.0.0
Latest Go to latest

The latest major version is v2.

Published: Mar 19, 2020 | License: MIT | Module: github.com/GameWith/eglm

Index

func DefaultLoggingFunc

func DefaultLoggingFunc(logger gwlog.Logger, param *Parameter, _ echo.Context) error

DefaultLoggingFunc is default write log function

func Middleware

func Middleware(config *Config) echo.MiddlewareFunc

Middleware echo write log middleware

type Config

type Config struct {
	Skipper     em.Skipper
	LoggingFunc LoggingFunc
}

Config is Middleware config

type DefaultLogField

type DefaultLogField struct {
	Type         string `json:"type"`
	Status       int    `json:"status"`
	Method       string `json:"method"`
	Path         string `json:"path"`
	UserAgent    string `json:"userAgent"`
	RemoteIP     string `json:"remoteIp"`
	ForwardedFor string `json:"forwardedFor"`
	Latency      int    `json:"latency"`
	Error        string `json:"error"`
	RequestID    string `json:"requestId"`
}

DefaultLogField echo default log fields.

func (*DefaultLogField) ToJSON

func (d *DefaultLogField) ToJSON() ([]byte, error)

ToJSON struct attributes to json

func (*DefaultLogField) ToMap

func (d *DefaultLogField) ToMap() map[string]interface{}

ToMap struct attributes to map

type LoggingFunc

type LoggingFunc func(logger gwlog.Logger, param *Parameter, c echo.Context) error

LoggingFunc is write log function

type Parameter

type Parameter struct {
	ID        string
	Method    string
	Host      string
	URI       string
	Status    int
	Path      string
	RemoteIP  string
	Referer   string
	UserAgent string
	Latency   int
	BytesIn   string
	BytesOut  string
	Error     error
}

Parameter is LoggingFunc parameter struct

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier