log

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: BSD-3-Clause Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TypeKey ...
	TypeKey = "file"
	// TypeValAccess ...
	TypeValAccess = "access.log"
	// TypeValRPC ...
	TypeValRPC = "rpc.log"
	// TypeValRedis ...
	TypeValRedis = "redis.log"
)

Functions

func BuildLogger

func BuildLogger(ctx context.Context) context.Context

BuildLogger ...

func ContextWithLogger

func ContextWithLogger(ctx context.Context, logg Logger) context.Context

ContextWithLogger function

func DPanic

func DPanic(ctx context.Context, args ...interface{})

DPanic ...

func DPanicf

func DPanicf(ctx context.Context, template string, args ...interface{})

DPanicf ...

func DPanicw

func DPanicw(ctx context.Context, msg string, keysAndValues ...interface{})

DPanicw ...

func Debug

func Debug(ctx context.Context, args ...interface{})

Debug ...

func Debugf

func Debugf(ctx context.Context, template string, args ...interface{})

Debugf ...

func Debugw

func Debugw(ctx context.Context, msg string, keysAndValues ...interface{})

Debugw ...

func Error

func Error(ctx context.Context, args ...interface{})

Error ...

func Errorf

func Errorf(ctx context.Context, template string, args ...interface{})

Errorf ...

func Errorw

func Errorw(ctx context.Context, msg string, keysAndValues ...interface{})

Errorw ...

func Fatal

func Fatal(ctx context.Context, args ...interface{})

Fatal ...

func Fatalf

func Fatalf(ctx context.Context, template string, args ...interface{})

Fatalf ...

func Fatalw

func Fatalw(ctx context.Context, msg string, keysAndValues ...interface{})

Fatalw ...

func GetTraceID

func GetTraceID(ctx context.Context) string

GetTraceID Get trace id from the context.

func Info

func Info(ctx context.Context, args ...interface{})

Info ...

func Infof

func Infof(ctx context.Context, template string, args ...interface{})

Infof ...

func Infow

func Infow(ctx context.Context, msg string, keysAndValues ...interface{})

Infow ...

func Log

func Log(ctx context.Context, keyvals ...interface{})

Log ...

func NewZapEncoderConfig

func NewZapEncoderConfig() zapcore.EncoderConfig

NewZapEncoderConfig ...

func Panic

func Panic(ctx context.Context, args ...interface{})

Panic ...

func Panicf

func Panicf(ctx context.Context, template string, args ...interface{})

Panicf ...

func Panicw

func Panicw(ctx context.Context, msg string, keysAndValues ...interface{})

Panicw ...

func SetDefaultLogger

func SetDefaultLogger(logg Logger)

SetDefaultLogger set default logger

func Sync

func Sync(ctx context.Context)

Sync ...

func Warn

func Warn(ctx context.Context, args ...interface{})

Warn ...

func Warnf

func Warnf(ctx context.Context, template string, args ...interface{})

Warnf ...

func Warnw

func Warnw(ctx context.Context, msg string, keysAndValues ...interface{})

Warnw ...

Types

type Logger

type Logger interface {
	DPanic(args ...interface{})
	DPanicf(template string, args ...interface{})
	DPanicw(msg string, keysAndValues ...interface{})
	Debug(args ...interface{})
	Debugf(template string, args ...interface{})
	Debugw(msg string, keysAndValues ...interface{})
	Error(args ...interface{})
	Errorf(template string, args ...interface{})
	Errorw(msg string, keysAndValues ...interface{})
	Fatal(args ...interface{})
	Fatalf(template string, args ...interface{})
	Fatalw(msg string, keysAndValues ...interface{})
	Info(args ...interface{})
	Infof(template string, args ...interface{})
	Infow(msg string, keysAndValues ...interface{})
	Panic(args ...interface{})
	Panicf(template string, args ...interface{})
	Panicw(msg string, keysAndValues ...interface{})
	Sync() error
	Warn(args ...interface{})
	Warnf(template string, args ...interface{})
	Warnw(msg string, keysAndValues ...interface{})
	With(args ...interface{}) Logger

	Log(keyvals ...interface{}) error
}

Logger interface

func GetDefaultLogger

func GetDefaultLogger() Logger

GetDefaultLogger return default logger

func Init

func Init(ctx context.Context, serviceName string, cfg config.Log) (logger Logger, err error)

Init ...

func LoggerFromContext

func LoggerFromContext(ctx context.Context) Logger

LoggerFromContext function

func NewLogger

func NewLogger(cfg config.Log) (Logger, error)

NewLogger new Logger

func With

func With(ctx context.Context, args ...interface{}) Logger

With ...

Jump to

Keyboard shortcuts

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