Categorygithub.com/GameWith/eglm/v2
modulepackage
2.0.0
Repository: https://github.com/gamewith/eglm.git
Documentation: pkg.go.dev

# README

eglm

echo log middleware library dedicated to gwlog.

Usage

Please add it to Middleware of echo.

Also, set gwlog.Logger for the Logger of the echo.

e := echo.New()
logger := gwlog.GetLogger()
logger.SetOutput(os.Stdout)
e.Logger = logger
e.Use(eglm.Middleware(&Config{}))

Options

Skipper

Log output is skip if the conditions are met in request.

The default is not to skip everything.

e := echo.New()
e.Logger = gwlog.GetLogger()
e.Use(eglm.Logger(&Config{
    Skipper: func(c echo.Context) bool {
        return c.Path() == "/"
    },
}))

LoggingFunc

Write the log via Middleware.

Use this when you want to customize the log contents.

If nothing is set, eglm.DefaultLoggingFunc will be set.

e := echo.New()
e.Logger = gwlog.GetLogger()
e.Use(eglm.Logger(&Config{
    LoggingFunc: func(logger gwlog.Logger, p *Parameter, c echo.Context) error {
    	logger.Print("a")
        return nil
    },
}))

# Functions

No description provided by the author
DefaultLoggingFunc is default write log function.
Middleware echo write log middleware.

# Structs

AccessLogField echo default log fields.
Config is Middleware config.
Parameter is LoggingFunc parameter struct.

# Type aliases

LoggingFunc is write log function.