mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
[优化] 添加清除规则链debug日志接口,修复日志读取长度
This commit is contained in:
@@ -16,6 +16,12 @@ func GetDebugData(ruleId, nodeId string) []message.DebugData {
|
||||
return nil
|
||||
}
|
||||
|
||||
func ClearDebugData(ruleId, nodeId string) {
|
||||
if data, ok := ruleChainDebugData.Data[ruleId]; ok {
|
||||
data.Clear(nodeId)
|
||||
}
|
||||
}
|
||||
|
||||
func GetDebugDataPage(page, pageSize int, ruleId, nodeId string) (int64, []message.DebugData) {
|
||||
if page < 1 {
|
||||
page = 1
|
||||
@@ -26,7 +32,7 @@ func GetDebugDataPage(page, pageSize int, ruleId, nodeId string) (int64, []messa
|
||||
total := len(data.Get(nodeId).Items)
|
||||
end := offset + pageSize
|
||||
if end >= total {
|
||||
end = total - 1
|
||||
end = total
|
||||
}
|
||||
return int64(total), data.Get(nodeId).Items[offset:end]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user