aop

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableConsoleColor

func DisableConsoleColor()

func ErrorLogger

func ErrorLogger() gin.HandlerFunc

func ErrorLoggerT

func ErrorLoggerT(typ gin.ErrorType) gin.HandlerFunc

func ForceConsoleColor

func ForceConsoleColor()

func Logger

func Logger(conf ...LoggerConfig) gin.HandlerFunc

func LoggerWithConfig

func LoggerWithConfig(conf LoggerConfig) gin.HandlerFunc

func LoggerWithFormatter

func LoggerWithFormatter(f LogFormatter) gin.HandlerFunc

func LoggerWithWriter

func LoggerWithWriter(out io.Writer, notlogged ...string) gin.HandlerFunc

func Recovery

func Recovery() gin.HandlerFunc

func RecoveryWithWriter

func RecoveryWithWriter(out io.Writer) gin.HandlerFunc

Types

type CustomResponseWriter

type CustomResponseWriter struct {
	gin.ResponseWriter
	// contains filtered or unexported fields
}

func (CustomResponseWriter) Unwrap

func (CustomResponseWriter) Write

func (w CustomResponseWriter) Write(data []byte) (int, error)

func (CustomResponseWriter) WriteString

func (w CustomResponseWriter) WriteString(s string) (int, error)

type LogFormatter

type LogFormatter func(params LogFormatterParams) string

type LogFormatterParams

type LogFormatterParams struct {
	Request *http.Request

	TimeStamp  time.Time
	StatusCode int
	Latency    time.Duration
	ClientIP   string

	Method       string
	Path         string
	ErrorMessage string

	BodySize int
	Keys     map[string]interface{}
	// contains filtered or unexported fields
}

func (*LogFormatterParams) IsOutputColor

func (p *LogFormatterParams) IsOutputColor() bool

func (*LogFormatterParams) MethodColor

func (p *LogFormatterParams) MethodColor() string

func (*LogFormatterParams) ResetColor

func (p *LogFormatterParams) ResetColor() string

func (*LogFormatterParams) StatusCodeColor

func (p *LogFormatterParams) StatusCodeColor() string

type LoggerConfig

type LoggerConfig struct {
	Formatter LogFormatter

	Output         io.Writer
	PrintAccessLog func() bool
	PrintBodyPaths func() map[string]struct{}

	SkipPaths []string
}

func (*LoggerConfig) ContainsPath

func (c *LoggerConfig) ContainsPath(path string) bool

Jump to

Keyboard shortcuts

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