(silent = false)
| 150 | } |
| 151 | |
| 152 | async function loadStats(silent = false) { |
| 153 | try { |
| 154 | const data = await api.get("/logs/stats"); |
| 155 | const levels = data.levels || {}; |
| 156 | applyCleanupDefaults(data); |
| 157 | el.statTotal.textContent = format.number(data.total || 0); |
| 158 | el.statInfo.textContent = format.number(levels.INFO || 0); |
| 159 | el.statWarning.textContent = format.number(levels.WARNING || 0); |
| 160 | el.statError.textContent = format.number(levels.ERROR || 0); |
| 161 | el.statCritical.textContent = format.number(levels.CRITICAL || 0); |
| 162 | el.latestLogTime.textContent = `最新日志: ${data.latest_at ? format.date(data.latest_at) : "-"}`; |
| 163 | } catch (error) { |
| 164 | if (!silent) { |
| 165 | toast.error(`加载统计失败: ${error?.message || error}`); |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | function resetFilters() { |
| 171 | el.filterLevel.value = ""; |
no test coverage detected