mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 10:17:17 +08:00
* Initial plan * feat: 添加操作日志记录功能和前端日志查看页面 Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * fix: 修复 HttpLog 中 IP 字符串处理的类型安全问题 Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * fix: lint * feat: 完善面板内日志记录,添加网站/数据库/项目/计划任务/备份CRUD日志 Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * feat: 完善更多模块的日志记录(证书/SSH/Webhook/用户/设置/安全) Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * fix: 改进cert_dns删除方法,在删除前获取实体信息用于日志记录 Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * fix: lint * feat: 从session获取操作员ID并在前端显示用户名 Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> * fix: lint --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> Co-authored-by: 耗子 <haozi@loli.email>
52 lines
1.4 KiB
Go
52 lines
1.4 KiB
Go
package biz
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
LogTypeApp = "app"
|
|
LogTypeDB = "db"
|
|
LogTypeHTTP = "http"
|
|
)
|
|
|
|
// 操作日志类型常量
|
|
const (
|
|
OperationTypePanel = "panel"
|
|
OperationTypeWebsite = "website"
|
|
OperationTypeDatabase = "database"
|
|
OperationTypeDatabaseUser = "database_user"
|
|
OperationTypeDatabaseServer = "database_server"
|
|
OperationTypeProject = "project"
|
|
OperationTypeCert = "cert"
|
|
OperationTypeFile = "file"
|
|
OperationTypeApp = "app"
|
|
OperationTypeCron = "cron"
|
|
OperationTypeBackup = "backup"
|
|
OperationTypeContainer = "container"
|
|
OperationTypeFirewall = "firewall"
|
|
OperationTypeSafe = "safe"
|
|
OperationTypeSSH = "ssh"
|
|
OperationTypeSetting = "setting"
|
|
OperationTypeMonitor = "monitor"
|
|
OperationTypeWebhook = "webhook"
|
|
OperationTypeUser = "user"
|
|
)
|
|
|
|
// LogEntry 日志条目
|
|
type LogEntry struct {
|
|
Time time.Time `json:"time"`
|
|
Level string `json:"level"`
|
|
Msg string `json:"msg"`
|
|
Type string `json:"type,omitempty"`
|
|
OperatorID uint `json:"operator_id,omitempty"`
|
|
OperatorName string `json:"operator_name,omitempty"`
|
|
Extra map[string]any `json:"extra,omitempty"`
|
|
}
|
|
|
|
// LogRepo 日志仓库接口
|
|
type LogRepo interface {
|
|
// List 获取日志列表
|
|
List(logType string, limit int) ([]LogEntry, error)
|
|
}
|