logger

package
v0.0.0-...-76745ad Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: BSD-3-Clause Imports: 1 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, args ...any)

Debug 打印调试日志

func DebugContext

func DebugContext(ctx context.Context, msg string, args ...any)

DebugContext 打印调试日志

func Error

func Error(msg string, args ...any)

Error 打印错误日志

func ErrorContext

func ErrorContext(ctx context.Context, msg string, args ...any)

ErrorContext 打印错误日志

func Info

func Info(msg string, args ...any)

Info 打印信息日志

func InfoContext

func InfoContext(ctx context.Context, msg string, args ...any)

InfoContext 打印信息日志

func NewContext

func NewContext(ctx context.Context, l Logger) context.Context

NewContext 创建一个新的上下文,将logger存入其中

func SetLogger

func SetLogger(logger Logger)

SetLogger 设置日志实现

func Warn

func Warn(msg string, args ...any)

Warn 打印警告日志

func WarnContext

func WarnContext(ctx context.Context, msg string, args ...any)

WarnContext 打印警告日志

Types

type Logger

type Logger interface {
	Debug(msg string, args ...any)
	Info(msg string, args ...any)
	Warn(msg string, args ...any)
	Error(msg string, args ...any)
}

Logger 日志接口

func FromContext

func FromContext(ctx context.Context) Logger

FromContext 从上下文中获取logger

Jump to

Keyboard shortcuts

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