log

package
v0.0.0-...-c4b7867 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogHandler

type LogHandler struct {
	slog.Handler
	// contains filtered or unexported fields
}

func NewLogHandler

func NewLogHandler(opts ...LogHandlerOption) (l *LogHandler)

NewLogHandler 创建日志处理器

func (*LogHandler) Handle

func (l *LogHandler) Handle(ctx context.Context, r slog.Record) (err error)

Handle 重写Handle方法, 添加错误调用堆栈信息

func (*LogHandler) SetDefaultLog

func (l *LogHandler) SetDefaultLog()

func (*LogHandler) SetLevel

func (l *LogHandler) SetLevel(level slog.Level)

SetLevel 设置日志等级

type LogHandlerOption

type LogHandlerOption func(*LogHandler)

func LogHandlerWithHandlerOptions

func LogHandlerWithHandlerOptions(opts *slog.HandlerOptions) LogHandlerOption

LogHandlerWithHandlerOptions 设置处理器配置

func LogHandlerWithIoWriter

func LogHandlerWithIoWriter(w io.Writer) LogHandlerOption

LogHandlerWithIoWriter 修改配置io写入

func LogHandlerWithLevel

func LogHandlerWithLevel(level slog.Level) LogHandlerOption

LogHandlerWithLevel 设置日志等级

func LogHandlerWithLumberjack

func LogHandlerWithLumberjack(lumberjackLog *lumberjack.Logger) LogHandlerOption

* 日志切割配置

func LogHandlerWithLumberjackDefault

func LogHandlerWithLumberjackDefault() LogHandlerOption

func LogHandlerWithStrLevel

func LogHandlerWithStrLevel(level string) LogHandlerOption

LogHandlerWithStrLevel 设置日志等级(字符串)

Jump to

Keyboard shortcuts

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