logger

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(format string, v ...any)

Debug 调试

func Error

func Error(format string, v ...any)

Error 错误

func Info

func Info(format string, v ...any)

Info 信息

func SetLevel

func SetLevel(l Level) error

SetLogger 设置日志实例

func SetLogger

func SetLogger(l Logger) error

SetLogger 设置日志实例

func Warn

func Warn(format string, v ...any)

Warn 警告

Types

type Level

type Level int

定义日志级别

const (
	LevelDebug Level = iota + 1
	LevelInfo
	LevelWarn
	LevelError
)

type LocalLogger

type LocalLogger struct {
}

LocalLogger 基于slog实现的日志

func (*LocalLogger) Debug

func (l *LocalLogger) Debug(format string, v ...any)

Debug 调试

func (*LocalLogger) Error

func (l *LocalLogger) Error(format string, v ...any)

Error 错误

func (*LocalLogger) Info

func (l *LocalLogger) Info(format string, v ...any)

Info 信息

func (*LocalLogger) Warn

func (l *LocalLogger) Warn(format string, v ...any)

Warn 警告

type Logger

type Logger interface {
	Debug(format string, v ...any)
	Info(format string, v ...any)
	Warn(format string, v ...any)
	Error(format string, v ...any)
}

Logger 日志接口定义

Jump to

Keyboard shortcuts

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