29 lines
577 B
Go
29 lines
577 B
Go
package util
|
|
|
|
import (
|
|
"context"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"github.com/gogf/gf/v2/os/gcache"
|
|
)
|
|
|
|
var RedisCache = func() *gcache.Cache {
|
|
cache := gcache.New()
|
|
cache.SetAdapter(gcache.NewAdapterRedis(g.Redis()))
|
|
return cache
|
|
}()
|
|
|
|
// Info 全局Info日志
|
|
func Info(ctx context.Context, args ...interface{}) {
|
|
g.Log().Info(ctx, args...)
|
|
}
|
|
|
|
// Debug 全局Debug日志
|
|
func Debug(ctx context.Context, args ...interface{}) {
|
|
g.Log().Debug(ctx, args...)
|
|
}
|
|
|
|
// Error 全局Error日志
|
|
func Error(ctx context.Context, args ...interface{}) {
|
|
g.Log().Error(ctx, args...)
|
|
}
|