feat: 重构日志处理,使用slog包替换原有日志函数,增强日志记录能力

This commit is contained in:
ryan
2026-03-13 15:25:33 +08:00
parent 79a7e024d3
commit 6d58d00c9d
12 changed files with 58 additions and 60 deletions
+2 -1
View File
@@ -3,6 +3,7 @@ package common
import (
"context"
"github.com/go-redis/redis/v8"
"log/slog"
"os"
"time"
)
@@ -14,7 +15,7 @@ var RedisEnabled = true
func InitRedisClient() (err error) {
if os.Getenv("REDIS_CONN_STRING") == "" {
RedisEnabled = false
SysLog("REDIS_CONN_STRING not set, Redis is not enabled")
slog.Info("redis disabled because REDIS_CONN_STRING is not set")
return nil
}
opt, err := redis.ParseURL(os.Getenv("REDIS_CONN_STRING"))