1 Star 0 Fork 0

Lucky.麒麟 / goboot

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
default.go 660 Bytes
一键复制 编辑 原始数据 按行查看 历史
Lucky.麒麟 提交于 2023-09-24 16:50 . v0.0.1
package logger
import (
"bytes"
"fmt"
"time"
)
func PrintLogger(level LogLevel, format string, args ...any) {
buff := new(bytes.Buffer)
defer func() {
buff.Reset()
buff = nil
}()
Blue(buff, "Admin", true)
// 写入日志日期
times := time.Now().Format("2006-01-02 15:04:05")
White(buff, times, true)
switch level {
case Info:
Blue(buff, "Info", true)
case Debug:
Green(buff, "Debug", true)
case Warn:
Yellow(buff, "Warn", true)
case Fail:
Magenta(buff, "Fail", true)
case Error:
Red(buff, "Error", true)
default:
White(buff, "Unknown", true)
}
buff.WriteString(fmt.Sprintf(format, args...))
fmt.Println(buff.String())
}
Go
1
https://gitee.com/molonglove/goboot.git
git@gitee.com:molonglove/goboot.git
molonglove
goboot
goboot
v1.0.4

搜索帮助

53164aa7 5694891 3bd8fe86 5694891