|
@@ -102,6 +102,7 @@ func RecordErrorLog(c *gin.Context, userId int, channelId int, modelName string,
|
|
|
isStream bool, group string, other map[string]interface{}) {
|
|
isStream bool, group string, other map[string]interface{}) {
|
|
|
logger.LogInfo(c, fmt.Sprintf("record error log: userId=%d, channelId=%d, modelName=%s, tokenName=%s, content=%s", userId, channelId, modelName, tokenName, content))
|
|
logger.LogInfo(c, fmt.Sprintf("record error log: userId=%d, channelId=%d, modelName=%s, tokenName=%s, content=%s", userId, channelId, modelName, tokenName, content))
|
|
|
username := c.GetString("username")
|
|
username := c.GetString("username")
|
|
|
|
|
+ requestId := c.GetString(common.RequestIdKey)
|
|
|
otherStr := common.MapToJsonStr(other)
|
|
otherStr := common.MapToJsonStr(other)
|
|
|
// 判断是否需要记录 IP
|
|
// 判断是否需要记录 IP
|
|
|
needRecordIp := false
|
|
needRecordIp := false
|
|
@@ -132,7 +133,7 @@ func RecordErrorLog(c *gin.Context, userId int, channelId int, modelName string,
|
|
|
}
|
|
}
|
|
|
return ""
|
|
return ""
|
|
|
}(),
|
|
}(),
|
|
|
- RequestId: c.GetString(common.RequestIdKey),
|
|
|
|
|
|
|
+ RequestId: requestId,
|
|
|
Other: otherStr,
|
|
Other: otherStr,
|
|
|
}
|
|
}
|
|
|
err := LOG_DB.Create(log).Error
|
|
err := LOG_DB.Create(log).Error
|
|
@@ -162,6 +163,7 @@ func RecordConsumeLog(c *gin.Context, userId int, params RecordConsumeLogParams)
|
|
|
}
|
|
}
|
|
|
logger.LogInfo(c, fmt.Sprintf("record consume log: userId=%d, params=%s", userId, common.GetJsonString(params)))
|
|
logger.LogInfo(c, fmt.Sprintf("record consume log: userId=%d, params=%s", userId, common.GetJsonString(params)))
|
|
|
username := c.GetString("username")
|
|
username := c.GetString("username")
|
|
|
|
|
+ requestId := c.GetString(common.RequestIdKey)
|
|
|
otherStr := common.MapToJsonStr(params.Other)
|
|
otherStr := common.MapToJsonStr(params.Other)
|
|
|
// 判断是否需要记录 IP
|
|
// 判断是否需要记录 IP
|
|
|
needRecordIp := false
|
|
needRecordIp := false
|
|
@@ -192,7 +194,7 @@ func RecordConsumeLog(c *gin.Context, userId int, params RecordConsumeLogParams)
|
|
|
}
|
|
}
|
|
|
return ""
|
|
return ""
|
|
|
}(),
|
|
}(),
|
|
|
- RequestId: c.GetString(common.RequestIdKey),
|
|
|
|
|
|
|
+ RequestId: requestId,
|
|
|
Other: otherStr,
|
|
Other: otherStr,
|
|
|
}
|
|
}
|
|
|
err := LOG_DB.Create(log).Error
|
|
err := LOG_DB.Create(log).Error
|