logger

package
v1.25.9 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 9 Imported by: 130

Documentation

Index

Constants

View Source
const (
	Cyan = cyan + Normal

	Magenta   = magenta + Normal
	DarkWhite = "\x1b[38;5;244m"
	Normal    = "m"
	Reset     = "\x1b[0m"
)
View Source
const TraceLevel = zapcore.DebugLevel - 1

Variables

This section is empty.

Functions

func BindFlags added in v1.4.0

func BindFlags(flags *pflag.FlagSet)

func BindGoFlags added in v1.21.2

func BindGoFlags()

func Debugf

func Debugf(format string, args ...interface{})

func Errorf

func Errorf(format string, args ...interface{})

func Fatalf

func Fatalf(format string, args ...interface{})

func Infof

func Infof(format string, args ...interface{})

func IsDebugEnabled

func IsDebugEnabled() bool

func IsJsonLogs added in v1.20.1

func IsJsonLogs() bool

func IsLevelEnabled added in v1.20.1

func IsLevelEnabled(level int) bool

func IsTraceEnabled

func IsTraceEnabled() bool

func NewZapEncoder added in v1.20.2

func NewZapEncoder() zapcore.Encoder

func Prettyf added in v1.3.0

func Prettyf(msg string, obj interface{})

Prettyf is like Tracef, but pretty prints the entire struct

func Secretf added in v1.3.0

func Secretf(format string, args ...interface{})

Secretf is like Tracef, but attempts to strip any secrets from the text

func SetLogger added in v1.20.0

func SetLogger(logger Logger)

func Tracef

func Tracef(format string, args ...interface{})

func UseLogsrus added in v1.20.1

func UseLogsrus()

func UseZap added in v1.4.0

func UseZap()

func Warnf

func Warnf(format string, args ...interface{})

Types

type Logger

type Logger interface {
	Warnf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Debugf(format string, args ...interface{})
	Tracef(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	WithValues(keysAndValues ...interface{}) Logger
	IsTraceEnabled() bool
	IsDebugEnabled() bool
	IsLevelEnabled(level int) bool
	GetLevel() int
	SetLogLevel(level int)
	SetMinLogLevel(level int)
	V(level int) Verbose
	Named(name string) Logger
	WithoutName() Logger
	WithSkipReportLevel(i int) Logger
}

func NewLogrusLogger added in v1.4.1

func NewLogrusLogger(existing logrusapi.Ext1FieldLogger, level int) Logger

func StandardLogger

func StandardLogger() Logger

func WithValues added in v1.4.2

func WithValues(keysAndValues ...interface{}) Logger

type Verbose added in v1.5.1

type Verbose interface {
	Infof(format string, args ...interface{})
	Enabled() bool
}

func V added in v1.5.1

func V(level int) Verbose

type ZapLogger added in v1.4.0

type ZapLogger struct {
	*zapapi.Logger
	Sugar *zapapi.SugaredLogger
	// contains filtered or unexported fields
}

func GetZapLogger added in v1.4.0

func GetZapLogger() *ZapLogger

func (ZapLogger) Debugf added in v1.4.0

func (zap ZapLogger) Debugf(format string, args ...interface{})

func (ZapLogger) Errorf added in v1.4.0

func (zap ZapLogger) Errorf(format string, args ...interface{})

func (ZapLogger) Fatalf added in v1.4.0

func (zap ZapLogger) Fatalf(format string, args ...interface{})

func (ZapLogger) GetLevel added in v1.4.0

func (z ZapLogger) GetLevel() int

func (ZapLogger) Infof added in v1.4.0

func (zap ZapLogger) Infof(format string, args ...interface{})

func (ZapLogger) IsDebugEnabled added in v1.4.0

func (zap ZapLogger) IsDebugEnabled() bool

func (ZapLogger) IsLevelEnabled added in v1.20.1

func (z ZapLogger) IsLevelEnabled(level int) bool

func (ZapLogger) IsTraceEnabled added in v1.4.0

func (zap ZapLogger) IsTraceEnabled() bool

func (ZapLogger) Named added in v1.20.1

func (z ZapLogger) Named(name string) Logger

func (ZapLogger) Prettyf added in v1.4.0

func (zap ZapLogger) Prettyf(msg string, obj interface{})

func (ZapLogger) Secretf added in v1.4.0

func (zap ZapLogger) Secretf(format string, args ...interface{})

func (ZapLogger) SetLogLevel added in v1.4.0

func (zap ZapLogger) SetLogLevel(level int)

func (ZapLogger) SetMinLogLevel added in v1.20.1

func (zap ZapLogger) SetMinLogLevel(level int)

func (ZapLogger) Tracef added in v1.4.0

func (zap ZapLogger) Tracef(format string, args ...interface{})

func (ZapLogger) V added in v1.5.1

func (zap ZapLogger) V(level int) Verbose

func (ZapLogger) Warnf added in v1.4.0

func (zap ZapLogger) Warnf(format string, args ...interface{})

func (ZapLogger) WithEncoder added in v1.20.1

func (z ZapLogger) WithEncoder(encoder zapcore.Encoder) ZapLogger

func (ZapLogger) WithSkipReportLevel added in v1.21.0

func (z ZapLogger) WithSkipReportLevel(i int) Logger

func (ZapLogger) WithValues added in v1.4.2

func (zap ZapLogger) WithValues(keysAndValues ...interface{}) Logger

func (ZapLogger) WithoutName added in v1.21.0

func (z ZapLogger) WithoutName() Logger

Jump to

Keyboard shortcuts

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