logger

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogLevel *slog.LevelVar

LogLevel 控制全局日志级别

Functions

func ColorEnabled added in v0.2.0

func ColorEnabled() bool

ColorEnabled 返回当前是否启用 ANSI 颜色输出

func Debug

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

Debug 打印详细调试信息 (保留 slog 完整上下文,输出至 os.Stderr)

func Debugf

func Debugf(format string, args ...any)

func Error

func Error(msg string)

Error 打印错误信息 (纯净格式,红色,输出至 os.Stderr)

func Errorf

func Errorf(format string, args ...any)

func Info

func Info(msg string)

Info 打印常规信息 (纯净格式,无时间戳等,输出至 os.Stdout)

func Infof

func Infof(format string, args ...any)

func Print

func Print(args ...any)

Print 等同于 fmt.Print,但受终端规范管控(预留空间)

func PrintError added in v0.2.0

func PrintError(msg string)

PrintError 打印纯净错误信号 (带红色彩色文本修饰,输出给 stderr)

func PrintErrorf

func PrintErrorf(format string, args ...any)

PrintErrorf 打印纯净错误信号 (带红色彩色文本修饰,输出给 stderr)

func PrintInfo added in v0.2.0

func PrintInfo(msg string)

PrintInfo 打印纯净信息 (带蓝色文本修饰)

func PrintInfof

func PrintInfof(format string, args ...any)

PrintInfof 打印纯净信息 (带蓝色文本修饰,但无[INFO]此类日志式前缀)

func PrintSuccess added in v0.2.0

func PrintSuccess(msg string)

PrintSuccess 打印成功信号 (带绿色彩色文本修饰)

func PrintSuccessf

func PrintSuccessf(format string, args ...any)

PrintSuccessf 打印成功信号 (带绿色彩色文本修饰,无日志式前缀)

func PrintWarn added in v0.2.0

func PrintWarn(msg string)

PrintWarn 打印警告信息 (黄色彩色文本修饰,输出给 stderr)

func PrintWarnf

func PrintWarnf(format string, args ...any)

PrintWarnf 打印警告信息 (黄色彩色文本修饰,输出给 stderr)

func Printf

func Printf(format string, args ...any)

Printf 等同于 fmt.Printf,无任何前缀和颜色

func SetColorMode added in v0.2.0

func SetColorMode(mode string)

SetColorMode 设置 ANSI 颜色输出模式:auto(自动检测)、never(禁用)、always(强制启用) 优先级:CLI flag > NO_COLOR 环境变量 > TTY 自动检测

func SetLogLevel

func SetLogLevel(level string)

SetLogLevel 动态设置日志级别

func Success

func Success(msg string)

Success 打印成功信息 (纯净格式,绿色,输出至 os.Stdout)

func Successf

func Successf(format string, args ...any)

func Warn

func Warn(msg string)

Warn 打印警告信息 (纯净格式,黄色,输出至 os.Stderr)

func Warnf

func Warnf(format string, args ...any)

Types

This section is empty.

Jump to

Keyboard shortcuts

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