feat: add a service for periodic cleanup of error accounts based on configuration.

This commit is contained in:
2026-02-01 06:02:39 +08:00
parent e867bc5cbd
commit 14a07e741e
5 changed files with 85 additions and 10 deletions

View File

@@ -242,3 +242,22 @@ func ClearLogs() {
defer logsMu.Unlock()
logs = make([]LogEntry, 0, 1000)
}
// ClearLogsByModule 按模块清除日志
func ClearLogsByModule(module string) int {
logsMu.Lock()
defer logsMu.Unlock()
// 过滤掉指定模块的日志
var newLogs []LogEntry
cleared := 0
for _, log := range logs {
if log.Module != module {
newLogs = append(newLogs, log)
} else {
cleared++
}
}
logs = newLogs
return cleared
}