mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-08-27 14:40:42 +08:00
fix g.Log()的使用
This commit is contained in:
@@ -20,7 +20,7 @@ var (
|
||||
Description: ``,
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
flags := parser.GetOptAll()
|
||||
g.Log().Debug(ctx, "flags:%+v", flags)
|
||||
g.Log().Debugf(ctx, "flags:%+v", flags)
|
||||
if len(flags) == 0 {
|
||||
g.Log().Fatal(ctx, "工具参数不能为空")
|
||||
return
|
||||
|
@@ -35,7 +35,7 @@ func ScanInstall(m Module) (record *InstallRecord, err error) {
|
||||
func IsInstall(m Module) bool {
|
||||
record, err := ScanInstall(m)
|
||||
if err != nil {
|
||||
g.Log().Debugf(m.Ctx(), err.Error())
|
||||
g.Log().Debug(m.Ctx(), err.Error())
|
||||
return false
|
||||
}
|
||||
if record == nil {
|
||||
|
4
server/internal/library/cache/cache.go
vendored
4
server/internal/library/cache/cache.go
vendored
@@ -37,7 +37,7 @@ func SetAdapter(ctx context.Context) {
|
||||
|
||||
if conf == nil {
|
||||
conf = new(model.CacheConfig)
|
||||
g.Log().Infof(ctx, "no cache driver is configured. default memory cache is used.")
|
||||
g.Log().Info(ctx, "no cache driver is configured. default memory cache is used.")
|
||||
}
|
||||
|
||||
switch conf.Adapter {
|
||||
@@ -45,7 +45,7 @@ func SetAdapter(ctx context.Context) {
|
||||
adapter = gcache.NewAdapterRedis(g.Redis())
|
||||
case "file":
|
||||
if conf.FileDir == "" {
|
||||
g.Log().Fatalf(ctx, "file path must be configured for file caching.")
|
||||
g.Log().Fatal(ctx, "file path must be configured for file caching.")
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,7 @@ func Get(ctx context.Context) *model.Context {
|
||||
func SetUser(ctx context.Context, user *model.Identity) {
|
||||
c := Get(ctx)
|
||||
if c == nil {
|
||||
g.Log().Warningf(ctx, "contexts.SetUser, c == nil ")
|
||||
g.Log().Warning(ctx, "contexts.SetUser, c == nil ")
|
||||
return
|
||||
}
|
||||
c.User = user
|
||||
@@ -44,7 +44,7 @@ func SetUser(ctx context.Context, user *model.Identity) {
|
||||
func SetResponse(ctx context.Context, response *model.Response) {
|
||||
c := Get(ctx)
|
||||
if c == nil {
|
||||
g.Log().Warningf(ctx, "contexts.SetResponse, c == nil ")
|
||||
g.Log().Warning(ctx, "contexts.SetResponse, c == nil ")
|
||||
return
|
||||
}
|
||||
c.Response = response
|
||||
@@ -54,7 +54,7 @@ func SetResponse(ctx context.Context, response *model.Response) {
|
||||
func SetModule(ctx context.Context, module string) {
|
||||
c := Get(ctx)
|
||||
if c == nil {
|
||||
g.Log().Warningf(ctx, "contexts.SetModule, c == nil ")
|
||||
g.Log().Warning(ctx, "contexts.SetModule, c == nil ")
|
||||
return
|
||||
}
|
||||
c.Module = module
|
||||
@@ -64,7 +64,7 @@ func SetModule(ctx context.Context, module string) {
|
||||
func SetTakeUpTime(ctx context.Context, takeUpTime int64) {
|
||||
c := Get(ctx)
|
||||
if c == nil {
|
||||
g.Log().Warningf(ctx, "contexts.SetTakeUpTime, c == nil ")
|
||||
g.Log().Warning(ctx, "contexts.SetTakeUpTime, c == nil ")
|
||||
return
|
||||
}
|
||||
c.TakeUpTime = takeUpTime
|
||||
@@ -120,7 +120,7 @@ func GetModule(ctx context.Context) string {
|
||||
func SetAddonName(ctx context.Context, name string) {
|
||||
c := Get(ctx)
|
||||
if c == nil {
|
||||
g.Log().Warningf(ctx, "contexts.SetAddonName, c == nil ")
|
||||
g.Log().Warning(ctx, "contexts.SetAddonName, c == nil ")
|
||||
return
|
||||
}
|
||||
Get(ctx).AddonName = name
|
||||
|
@@ -56,7 +56,7 @@ func FilterAuthWithField(filterField string) func(m *gdb.Model) *gdb.Model {
|
||||
}
|
||||
|
||||
if role == nil {
|
||||
g.Log().Panicf(ctx, "failed to role information roleModel == nil")
|
||||
g.Log().Panic(ctx, "failed to role information roleModel == nil")
|
||||
}
|
||||
|
||||
sq := g.Model("admin_member").Fields("id")
|
||||
@@ -77,7 +77,7 @@ func FilterAuthWithField(filterField string) func(m *gdb.Model) *gdb.Model {
|
||||
case consts.RoleDataSelfAndAllSub: // 自己和全部下级
|
||||
m = m.WhereIn(filterField, GetSelfAndAllSub(co.User.Id))
|
||||
default:
|
||||
g.Log().Panicf(ctx, "dataScope is not registered")
|
||||
g.Log().Panic(ctx, "dataScope is not registered")
|
||||
}
|
||||
|
||||
return m
|
||||
|
@@ -174,7 +174,7 @@ func GetPublicIP(ctx context.Context) (ip string, err error) {
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
g.Log().Infof(ctx, "publicIP address Parsing failure, check the network and firewall blocking.")
|
||||
g.Log().Info(ctx, "publicIP address Parsing failure, check the network and firewall blocking.")
|
||||
return "0.0.0.0", nil
|
||||
}
|
||||
return data.Ip, nil
|
||||
|
@@ -81,7 +81,7 @@ func init() {
|
||||
mqProducerInstanceMap = make(map[string]MqProducer)
|
||||
mqConsumerInstanceMap = make(map[string]MqConsumer)
|
||||
if err := g.Cfg().MustGet(ctx, "queue").Scan(&config); err != nil {
|
||||
g.Log().Warning(ctx, "queue init err:%+v", err)
|
||||
g.Log().Warningf(ctx, "queue init err:%+v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -16,7 +16,7 @@ func (s *sMiddleware) Blacklist(r *ghttp.Request) {
|
||||
response.JsonExit(r, gcode.CodeServerBusy.Code(), "请求异常,已被封禁,如有疑问请联系管理员!")
|
||||
}
|
||||
} else {
|
||||
g.Log().Infof(r.Context(), "blacklists uninitialized")
|
||||
g.Log().Info(r.Context(), "blacklists uninitialized")
|
||||
}
|
||||
|
||||
r.Middleware.Next()
|
||||
|
@@ -291,7 +291,7 @@ func (manager *ClientManager) start() {
|
||||
}
|
||||
}
|
||||
case <-manager.closeSignal:
|
||||
g.Log().Infof(ctxManager, "websocket closeSignal quit..")
|
||||
g.Log().Info(ctxManager, "websocket closeSignal quit..")
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -30,7 +30,7 @@ func IsDNSName(s string) bool {
|
||||
func IsHTTPS(ctx context.Context) bool {
|
||||
r := ghttp.RequestFromCtx(ctx)
|
||||
if r == nil {
|
||||
g.Log().Infof(ctx, "IsHTTPS ctx not request")
|
||||
g.Log().Info(ctx, "IsHTTPS ctx not request")
|
||||
return false
|
||||
}
|
||||
var (
|
||||
|
Reference in New Issue
Block a user