mirror of
https://git.fightbot.fun/hxuanyu/BingPaper.git
synced 2026-02-15 10:19:32 +08:00
增加日志配置选项支持,优化日志初始化与数据库日志记录
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user