增加日志配置选项支持,优化日志初始化与数据库日志记录

This commit is contained in:
2026-01-27 10:32:43 +08:00
parent 729d335a69
commit e6e6d3b222
11 changed files with 220 additions and 11 deletions

View File

@@ -10,8 +10,10 @@ import (
"BingPaper/internal/model"
"BingPaper/internal/service/image"
"BingPaper/internal/storage"
"BingPaper/internal/util"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
// GetToday 获取今日图片
@@ -187,6 +189,7 @@ func handleImageResponse(c *gin.Context, img *model.Image) {
func serveLocal(c *gin.Context, key string) {
reader, contentType, err := storage.GlobalStorage.Get(context.Background(), key)
if err != nil {
util.Logger.Error("Failed to get image from storage", zap.String("key", key), zap.Error(err))
c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to get image"})
return
}