mwLogger

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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLoggerMiddleware

func NewLoggerMiddleware(isStdout bool, writerDir string) (gin.HandlerFunc, error)

func NewLoggerMiddlewareSmoothFail

func NewLoggerMiddlewareSmoothFail(isStdout bool, writerDir string) gin.HandlerFunc

Types

type LogFormatterParams

type LogFormatterParams struct {
	TimeStamp    time.Time              `json:"time"`
	StatusCode   int                    `json:"code"`
	Latency      time.Duration          `json:"latency"`
	ClientIP     string                 `json:"ip"`
	Method       string                 `json:"method"`
	Path         string                 `json:"path"`
	ErrorMessage string                 `json:"errorMessage"`
	BodySize     int                    `json:"bodySize"`
	Keys         map[string]interface{} `json:"keys"`
}

func (*LogFormatterParams) MethodColor

func (p *LogFormatterParams) MethodColor() string

MethodColor is the ANSI color for appropriately logging http method to a terminal.

func (*LogFormatterParams) ResetColor

func (p *LogFormatterParams) ResetColor() string

ResetColor resets all escape attributes.

func (*LogFormatterParams) StatusCodeColor

func (p *LogFormatterParams) StatusCodeColor() string

StatusCodeColor is the ANSI color for appropriately logging http status code to a terminal.

Jump to

Keyboard shortcuts

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