feat: enable error logging configuration in docker-compose and application

This commit is contained in:
CaIon
2025-04-29 16:26:55 +08:00
parent b64480b750
commit fd6838e690
3 changed files with 6 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import (
"log"
"net/http"
"one-api/common"
constant2 "one-api/constant"
"one-api/dto"
"one-api/middleware"
"one-api/model"
@@ -40,7 +41,7 @@ func relayHandler(c *gin.Context, relayMode int) *dto.OpenAIErrorWithStatusCode
err = relay.TextHelper(c)
}
if err != nil {
if constant2.ErrorLogEnabled && err != nil {
// 保存错误日志到mysql中
userId := c.GetInt("id")
tokenName := c.GetString("token_name")