mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-25 07:16:51 +00:00
chore: remove monitor debug logs and add log clear action
This commit is contained in:
@@ -897,6 +897,21 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
const handleClearLog = async () => {
|
||||
const confirmed = window.confirm('确定清空 wcdb.log 吗?')
|
||||
if (!confirmed) return
|
||||
try {
|
||||
const result = await window.electronAPI.log.clear()
|
||||
if (!result.success) {
|
||||
showMessage(result.error || '清空日志失败', false)
|
||||
return
|
||||
}
|
||||
showMessage('日志已清空', true)
|
||||
} catch (e: any) {
|
||||
showMessage(`清空日志失败: ${e}`, false)
|
||||
}
|
||||
}
|
||||
|
||||
const handleClearAnalyticsCache = async () => {
|
||||
if (isClearingCache) return
|
||||
setIsClearingAnalyticsCache(true)
|
||||
@@ -1427,6 +1442,9 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
||||
<button className="btn btn-secondary" onClick={handleCopyLog}>
|
||||
<Copy size={16} /> 复制日志内容
|
||||
</button>
|
||||
<button className="btn btn-secondary" onClick={handleClearLog}>
|
||||
<Trash2 size={16} /> 清空日志
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
1
src/types/electron.d.ts
vendored
1
src/types/electron.d.ts
vendored
@@ -69,6 +69,7 @@ export interface ElectronAPI {
|
||||
log: {
|
||||
getPath: () => Promise<string>
|
||||
read: () => Promise<{ success: boolean; content?: string; error?: string }>
|
||||
clear: () => Promise<{ success: boolean; error?: string }>
|
||||
debug: (data: any) => void
|
||||
}
|
||||
diagnostics: {
|
||||
|
||||
Reference in New Issue
Block a user