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
+3 -2
View File
@@ -5,6 +5,7 @@ import (
"encoding/json"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
"log/slog"
"net/http"
"net/url"
)
@@ -37,7 +38,7 @@ func TurnstileCheck() gin.HandlerFunc {
"remoteip": {c.ClientIP()},
})
if err != nil {
common.SysError(err.Error())
slog.Error("turnstile verification request failed", "error", err)
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": err.Error(),
@@ -49,7 +50,7 @@ func TurnstileCheck() gin.HandlerFunc {
var res turnstileCheckResponse
err = json.NewDecoder(rawRes.Body).Decode(&res)
if err != nil {
common.SysError(err.Error())
slog.Error("decode turnstile verification response failed", "error", err)
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": err.Error(),