logging

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugLevel = iota
	InfoLevel
	WarningLevel
	ErrorLevel
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LogAdapter

type LogAdapter struct {
	// contains filtered or unexported fields
}

LogAdapter 是一个适配器,适配 Go 标准库的 log 包

func NewLogAdapter

func NewLogAdapter(out io.Writer, level int) *LogAdapter

NewLogAdapter 创建一个 LogAdapter 实例

func (*LogAdapter) Debugf

func (l *LogAdapter) Debugf(format string, args ...any)

Debugf 打印 debug 级别日志

func (*LogAdapter) Errorf

func (l *LogAdapter) Errorf(format string, args ...any)

Errorf 打印错误级别日志

func (*LogAdapter) Infof

func (l *LogAdapter) Infof(format string, args ...any)

Infof 打印 info 级别日志

func (*LogAdapter) SetLogLevel

func (l *LogAdapter) SetLogLevel(level int)

func (*LogAdapter) SetLogger

func (l *LogAdapter) SetLogger(logger *log.Logger)

func (*LogAdapter) Warningf

func (l *LogAdapter) Warningf(format string, args ...any)

Warningf 打印警告级别日志

type Logger

type Logger interface {
	Debugf(format string, args ...any)
	Infof(format string, args ...any)
	Warningf(format string, args ...any)
	Errorf(format string, args ...any)
}

Jump to

Keyboard shortcuts

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