Akvicor
919333560a
Test / testing (1.20.13, ubuntu-latest) (push) Successful in 1m41s
Details
Test / testing (>=1.21, ubuntu-latest) (push) Successful in 2m6s
Details
|
||
---|---|---|
.gitea/workflows | ||
.gitignore | ||
LICENSE | ||
README.md | ||
file.go | ||
glog.go | ||
glog_test.go | ||
go.mod |
README.md
glog
自用的golang日志库
import "git.viry.cc/gomod/glog"
类型
使用SetMask(m int)
设置每种消息是否输出
Unknown(format string, values ...any)
: 写入os.Stdout
Debug(format string, values ...any)
: 写入os.Stdout
Trace(format string, values ...any)
: 写入os.Stdout
Info(format string, values ...any)
: 写入os.Stdout
Warning(format string, values ...any)
: 写入os.Stdout
Error(format string, values ...any)
: 写入os.Stderr
Fatal(format string, values ...any)
: 写入os.Stderr
前缀
支持添加时间、类型、调用位置,使用SetFlag(f int)
设置前缀。
文件
支持在显示在控制台的同时写入文件,通过SetLogFile(path string) error
设置文件,设置后会自动写入此文件。
通过CloseFile()
关闭文件,关闭后不再写入文件