chore: remove monitor debug logs and add log clear action
This commit is contained in:
1 parent
8d5527990b
commit
731f022669
8 files changed
+61
-10
No files matched your search
@@ -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>
|
||||
|
||||
Vendored
+1
@@ -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