初始化2
This commit is contained in:
@@ -10,6 +10,24 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// GetSystemLogs 获取系统运行日志
|
||||
// GET /api/admin/monitor/logs?limit=200
|
||||
func (c *MonitorController) GetSystemLogs(ctx *gin.Context) {
|
||||
limit := 200
|
||||
if l, err := parseIntQuery(ctx, "limit"); err == nil && l > 0 {
|
||||
limit = l
|
||||
}
|
||||
if limit > 2000 {
|
||||
limit = 2000
|
||||
}
|
||||
|
||||
entries := utils.LogBuf.Get(limit)
|
||||
utils.Success(ctx, gin.H{
|
||||
"total": utils.LogBuf.Count(),
|
||||
"entries": entries,
|
||||
})
|
||||
}
|
||||
|
||||
// MonitorController 监控控制器
|
||||
type MonitorController struct {
|
||||
fileRepo *repository.FileRepository
|
||||
|
||||
Reference in New Issue
Block a user