logger

package
v1.17.6 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaskLog = func(text string) string {
	return text
}

MaskLog func for mask sensitive information from log

Functions

func CyanColor added in v1.14.0

func CyanColor(str interface{}) string

CyanColor func

func GreenColor added in v1.14.0

func GreenColor(str interface{}) string

GreenColor func

func InitZap

func InitZap(opts ...OptionFunc)

InitZap logger with default writer to stdout

func Log

func Log(level zapcore.Level, message string, context string, scope string)

Log func

func LogE

func LogE(message string)

LogE error

func LogEf

func LogEf(format string, i ...interface{})

LogEf error with format

func LogGreen

func LogGreen(str string)

LogGreen log with green color

func LogI

func LogI(message string)

LogI info

func LogIf

func LogIf(format string, i ...interface{})

LogIf info with format

func LogIfError added in v1.11.26

func LogIfError(err error)

LogIfError log if error not nil

func LogPanicIfError added in v1.11.26

func LogPanicIfError(err error)

LogPanicIfError log if error not nil

func LogRed

func LogRed(str string)

LogRed log with red color

func LogWithDefer

func LogWithDefer(str string) (deferFunc func())

LogWithDefer return defer func for status

func LogWithField added in v1.9.3

func LogWithField(level zapcore.Level, fields map[string]interface{})

LogWithField func

func LogYellow

func LogYellow(str string)

LogYellow log with yellow color

func RedColor added in v1.14.0

func RedColor(str interface{}) string

RedColor func

func SetMaskLog added in v1.17.0

func SetMaskLog(masker Masker)

SetMaskLog set MaskLog function

func YellowColor added in v1.14.0

func YellowColor(str interface{}) string

YellowColor func

Types

type Masker added in v1.17.0

type Masker interface {
	Mask(text string) string
}

func NewMasker added in v1.17.0

func NewMasker(keywords ...string) Masker

NewMasker create new logger masker with pattern, if patternType is empty will be create with default pattern type password

type Option added in v1.9.3

type Option struct {
	MultiWriter []io.Writer
}

Option for init logger option

type OptionFunc added in v1.9.3

type OptionFunc func(*Option)

OptionFunc func

func OptionAddWriter added in v1.9.3

func OptionAddWriter(w io.Writer) OptionFunc

OptionAddWriter option func

func OptionSetWriter added in v1.12.2

func OptionSetWriter(w ...io.Writer) OptionFunc

OptionSetWriter option func, overide all log writer

type PatternType added in v1.17.0

type PatternType struct {
	// contains filtered or unexported fields
}

func GeneratePatternType added in v1.17.0

func GeneratePatternType(keyword string) (patterns []PatternType)

GeneratePatternType generate default patter type

func (*PatternType) ContainsInEnds added in v1.17.0

func (p *PatternType) ContainsInEnds(c rune) bool

Jump to

Keyboard shortcuts

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