Back to godoc.org

Package utils

v1.7.1
Latest Go to latest

The latest major version is .

Published: Jun 20, 2020 | License: BSD-3-Clause | Module: github.com/azak-azkaran/cascade

Index

Variables

var (
	Atom = zap.NewAtomicLevel()

	Sugar *zap.SugaredLogger
)
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.

func EnableDebug

func EnableDebug()

func EnableError

func EnableError()

func EnableInfo

func EnableInfo()

func EnableWarning

func EnableWarning()

func GetClient

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

func GetLogger

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()
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

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