logx

package
v2.1.41 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const SlsTopic = "x-sls-topic"

Variables

This section is empty.

Functions

func AppendKVs added in v2.1.18

func AppendKVs(keyvals ...interface{})

AppendKVs 可以进行自定义

func ExtractCtx added in v2.1.18

func ExtractCtx(ctx context.Context, logType LogType) (keyvals []interface{})

func SetCtxKV added in v2.1.18

func SetCtxKV(ctx context.Context, key, val string) context.Context

func SetCtxKVS added in v2.1.18

func SetCtxKVS(ctx context.Context, kvs map[string]string) context.Context

Types

type GLog

type GLog interface {
	Info(args ...interface{})
	InfoF(format string, args ...interface{})

	Debug(args ...interface{})
	DebugF(format string, args ...interface{})

	Warn(args ...interface{})
	WarnF(format string, args ...interface{})

	Error(args ...interface{})
	ErrorF(format string, args ...interface{})

	Fatal(args ...interface{})
	FatalF(format string, args ...interface{})

	CommonLog(level Level, ctx context.Context, keyvals ...interface{}) error
}

type Level added in v2.1.18

type Level int8
const (
	LevelDebug Level = iota - 1
	LevelInfo
	LevelWarn
	LevelError
	LevelFatal
)

func (Level) String added in v2.1.18

func (l Level) String() string

type LogType added in v2.1.18

type LogType int64
const (
	LogTypeZap LogType = iota + 1
	LogTypeSls
)

type Valuer added in v2.1.18

type Valuer func(ctx context.Context) interface{}

func Caller added in v2.1.18

func Caller(depth int) Valuer

Caller returns a Valuer that returns a pkg/file:line description of the caller.

func GetCtxKey added in v2.1.18

func GetCtxKey(key string) Valuer

func Timestamp added in v2.1.18

func Timestamp(layout string) Valuer

Timestamp returns a timestamp Valuer with a custom time format.

func TraceID added in v2.1.18

func TraceID() Valuer

Jump to

Keyboard shortcuts

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