-
This commit is contained in:
@ -218,17 +218,29 @@ func (h *ExecutionHandler) Cancel(c *gin.Context) {
|
||||
|
||||
func (h *ExecutionHandler) GetLogs(c *gin.Context) {
|
||||
idStr := c.Param("id")
|
||||
h.logger.Debug("GetLogs endpoint called",
|
||||
zap.String("execution_id", idStr),
|
||||
zap.String("client_ip", c.ClientIP()))
|
||||
|
||||
id, err := uuid.Parse(idStr)
|
||||
if err != nil {
|
||||
h.logger.Warn("Invalid execution ID provided to GetLogs",
|
||||
zap.String("id", idStr),
|
||||
zap.Error(err))
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid execution ID"})
|
||||
return
|
||||
}
|
||||
|
||||
if !h.authService.HasPermission(c.Request.Context(), "faas.read") {
|
||||
h.logger.Warn("Insufficient permissions for GetLogs",
|
||||
zap.String("execution_id", idStr))
|
||||
c.JSON(http.StatusForbidden, gin.H{"error": "Insufficient permissions"})
|
||||
return
|
||||
}
|
||||
|
||||
h.logger.Debug("Calling execution service GetLogs",
|
||||
zap.String("execution_id", idStr))
|
||||
|
||||
logs, err := h.executionService.GetLogs(c.Request.Context(), id)
|
||||
if err != nil {
|
||||
h.logger.Error("Failed to get execution logs", zap.String("id", idStr), zap.Error(err))
|
||||
@ -236,6 +248,10 @@ func (h *ExecutionHandler) GetLogs(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
h.logger.Debug("Successfully retrieved logs from execution service",
|
||||
zap.String("execution_id", idStr),
|
||||
zap.Int("log_count", len(logs)))
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"logs": logs,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user