Skip to content

Commit

Permalink
feat: 日志只读取 1000 行
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Oct 29, 2023
1 parent 83ebe76 commit 2202e1a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/http/controllers/cron_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,5 +273,7 @@ func (c *CronController) Log(ctx http.Context) http.Response {
return Error(ctx, http.StatusUnprocessableEntity, "日志文件不存在")
}

return Success(ctx, tools.Read(cron.Log))
log := tools.Exec("tail -n 1000 " + cron.Log)

return Success(ctx, log)
}
2 changes: 1 addition & 1 deletion app/http/controllers/task_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (r *TaskController) Log(ctx http.Context) http.Response {
return Error(ctx, http.StatusInternalServerError, "系统内部错误")
}

log := tools.Read(task.Log)
log := tools.Exec("tail -n 1000 " + task.Log)

return Success(ctx, log)
}
Expand Down

0 comments on commit 2202e1a

Please sign in to comment.