feat: refactor go.mod.

This commit is contained in:
tx7do
2024-11-14 15:47:21 +08:00
parent f3d17b9d34
commit 120029bb01
16 changed files with 675 additions and 175 deletions

View File

@@ -3,12 +3,18 @@ package logrus
import (
logrusLogger "github.com/go-kratos/kratos/contrib/log/logrus/v2"
"github.com/go-kratos/kratos/v2/log"
"github.com/sirupsen/logrus"
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
)
// NewLogger 创建一个新的日志记录器 - Logrus
func NewLogger(cfg *conf.Logger) log.Logger {
if cfg == nil || cfg.Logrus == nil {
return nil
}
loggerLevel, err := logrus.ParseLevel(cfg.Logrus.Level)
if err != nil {
loggerLevel = logrus.InfoLevel