mirror of
https://github.com/bufanyun/hotgo.git
synced 2026-04-28 22:14:30 +08:00
模块化定时任务,方便在插件中注册任务;增加日志分组
This commit is contained in:
@@ -3,13 +3,8 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package queue
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type RocketMqLogger struct {
|
||||
Flag string
|
||||
LevelLog string
|
||||
@@ -22,18 +17,17 @@ func (l *RocketMqLogger) Debug(msg string, fields map[string]interface{}) {
|
||||
if msg == "" && len(fields) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
if l.LevelLog == "debug" || l.LevelLog == "all" {
|
||||
g.Log().Debug(ctx, msg)
|
||||
Logger().Debug(ctx, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *RocketMqLogger) Level(level string) {
|
||||
g.Log().Info(ctx, level)
|
||||
Logger().Info(ctx, level)
|
||||
}
|
||||
|
||||
func (l *RocketMqLogger) OutputPath(path string) (err error) {
|
||||
g.Log().Info(ctx, path)
|
||||
Logger().Info(ctx, path)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -46,7 +40,7 @@ func (l *RocketMqLogger) Info(msg string, fields map[string]interface{}) {
|
||||
}
|
||||
|
||||
if l.LevelLog == "info" || l.LevelLog == "all" {
|
||||
g.Log().Info(ctx, msg)
|
||||
Logger().Info(ctx, msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +53,7 @@ func (l *RocketMqLogger) Warning(msg string, fields map[string]interface{}) {
|
||||
}
|
||||
|
||||
if l.LevelLog == "warn" || l.LevelLog == "all" {
|
||||
g.Log().Warning(ctx, msg)
|
||||
Logger().Warning(ctx, msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +65,7 @@ func (l *RocketMqLogger) Error(msg string, fields map[string]interface{}) {
|
||||
return
|
||||
}
|
||||
if l.LevelLog == "error" || l.LevelLog == "all" {
|
||||
g.Log().Error(ctx, msg)
|
||||
Logger().Error(ctx, msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +78,6 @@ func (l *RocketMqLogger) Fatal(msg string, fields map[string]interface{}) {
|
||||
}
|
||||
|
||||
if l.LevelLog == "fatal" || l.LevelLog == "all" {
|
||||
g.Log().Fatal(ctx, msg)
|
||||
Logger().Fatal(ctx, msg)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user