代码拉取完成,页面将自动刷新
同步操作将从 aurora-engine/gobatis 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package gobatis
import (
"bytes"
"fmt"
"github.com/sirupsen/logrus"
"os"
"sync"
)
var logs *logrus.Logger
// Log 自定义Log需要实现的借口
type Log interface {
Info(...interface{})
Error(...interface{})
Debug(...interface{})
Panic(...interface{})
Warn(...interface{})
}
func init() {
logs = logrus.New()
f := &Formatter{ProjectName: "SGO"}
f.Buf = &sync.Pool{New: func() any {
return new(bytes.Buffer)
}}
logs.SetFormatter(f)
logs.Out = os.Stdout
}
func Level(level logrus.Level) {
logs.SetLevel(level)
}
type Formatter struct {
ProjectName string
Buf *sync.Pool
*logrus.TextFormatter
}
func Info(msg ...any) {
logs.Infoln(msg...)
}
func Debug(msg ...any) {
logs.Debugln(msg...)
}
func Error(err ...any) {
logs.Errorln(err...)
}
func Panic(v ...any) {
logs.Panicln(v...)
}
func (format *Formatter) Format(entry *logrus.Entry) ([]byte, error) {
buf := format.Buf.Get().(*bytes.Buffer)
defer format.Buf.Put(buf)
defer buf.Reset()
var f = ""
t := entry.Time.Format("2006-01-02 15:04:05")
if entry.Data != nil && len(entry.Data) > 0 {
f = fmt.Sprintf("[%s] %s [%s] [%s] -> %s\n", format.ProjectName, t, entry.Level, entry.Data["type"], entry.Message)
} else {
f = fmt.Sprintf("[%s] %s [%s] -> %s\n", format.ProjectName, t, entry.Level, entry.Message)
}
buf.WriteString(f)
return buf.Bytes(), nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。