log

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewKisDefaultSlog added in v1.0.3

func MustNewKisDefaultSlog(opts ...KisLogOptions)

func SetLogger

func SetLogger(newlog KisLogger)

SetLogger 设置KisLog对象, 可以是用户自定义的Logger对象

Types

type KisLogOptions added in v1.0.3

type KisLogOptions func(k *kisDefaultSlog)

func WithJSONFormat added in v1.0.3

func WithJSONFormat(jsonFormat bool) KisLogOptions

func WithLevel added in v1.0.3

func WithLevel(level slog.Level) KisLogOptions

func WithLocation added in v1.0.3

func WithLocation(location bool) KisLogOptions

func WithWriter added in v1.0.3

func WithWriter(writer io.Writer) KisLogOptions

type KisLogger

type KisLogger interface {
	// InfoFX 有上下文的Info级别日志接口, format字符串格式
	InfoFX(ctx context.Context, str string, v ...interface{})
	// ErrorFX 有上下文的Error级别日志接口, format字符串格式
	ErrorFX(ctx context.Context, str string, v ...interface{})
	// DebugFX 有上下文的Debug级别日志接口, format字符串格式
	DebugFX(ctx context.Context, str string, v ...interface{})

	// InfoF 无上下文的Info级别日志接口, format字符串格式
	InfoF(str string, v ...interface{})
	// ErrorF 无上下文的Error级别日志接口, format字符串格式
	ErrorF(str string, v ...interface{})
	// DebugF 无上下文的Debug级别日志接口, format字符串格式
	DebugF(str string, v ...interface{})

	// InfoX 有上下文的Info级别日志接口, format字符串格式
	InfoX(ctx context.Context, str string, v ...interface{})
	// ErrorX 有上下文的Error级别日志接口, format字符串格式
	ErrorX(ctx context.Context, str string, v ...interface{})
	// DebugX 有上下文的Debug级别日志接口, format字符串格式
	DebugX(ctx context.Context, str string, v ...interface{})

	// Info 无上下文的Info级别日志接口, format字符串格式
	Info(str string, v ...interface{})
	// Error 无上下文的Error级别日志接口, format字符串格式
	Error(str string, v ...interface{})
	// Debug 无上下文的Debug级别日志接口, format字符串格式
	Debug(str string, v ...interface{})

	// SetDebugMode 设置Debug模式
	SetDebugMode()
}

func Logger

func Logger() KisLogger

Logger 获取到kisLog对象

Jump to

Keyboard shortcuts

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