utils

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2020 License: BSD-3-Clause Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Atom = zap.NewAtomicLevel()

	Sugar *zap.SugaredLogger
)
View Source
var DefaultLogFormatter = func(param gin.LogFormatterParams) string {
	var methodColor, resetColor string

	methodColor = param.MethodColor()
	resetColor = param.ResetColor()

	if param.Latency > time.Minute {

		param.Latency = param.Latency - param.Latency%time.Second
	}
	return fmt.Sprintf("GIN: %s %-7s %s| %13v | %15s | %s\n%s",

		methodColor, param.Method, resetColor,
		param.Latency,
		param.Request.URL.Host,
		param.Path,
		param.ErrorMessage,
	)
}

defaultLogFormatter is the default log format function Logger middleware uses.

Functions

func EnableDebug added in v1.7.0

func EnableDebug()

func EnableError added in v1.7.0

func EnableError()

func EnableInfo added in v1.7.0

func EnableInfo()

func EnableWarning added in v1.7.0

func EnableWarning()

func GetClient

func GetClient(proxyUrl string, timeout int) (*http.Client, error)

func GetLogger added in v1.7.0

func GetLogger() *log.Logger

func GetResponse

func GetResponse(proxyUrl string, requestUrl string) (*http.Response, error)

func GetResponseDump

func GetResponseDump(proxyUrl string, requestUrl string) ([]byte, error)

func Init

func Init()

Types

This section is empty.

Jump to

Keyboard shortcuts

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