feat(update-center): 添加详细日志记录以帮助调试更新中心服务

在更新中心服务的关键路径添加console.log和console.error输出
包括服务刷新、包解析、命令执行等环节的输入输出和中间状态
便于排查更新中心相关的问题
This commit is contained in:
2026-04-16 13:48:08 +08:00
parent 309b9bc003
commit e72553d570
4 changed files with 54 additions and 19 deletions
@@ -166,22 +166,27 @@ export const createUpdateCenterService = (
storeFilter: StoreFilter = currentStoreFilter,
): Promise<UpdateCenterServiceState> => {
currentStoreFilter = storeFilter;
console.log(`[UpdateCenter] service.refresh called with storeFilter=${storeFilter}`);
queue.startRefresh();
emit();
try {
const ignoredEntries = await loadIgnored();
console.log(`[UpdateCenter] ignoredEntries count=${ignoredEntries.size}`);
const loadedItems = normalizeLoadedItems(
await options.loadItems(currentStoreFilter),
);
console.log(`[UpdateCenter] loadItems returned: items=${loadedItems.items.length}, warnings=${loadedItems.warnings.length}`, loadedItems.warnings);
const items = sortIgnoredItems(
applyIgnoredEntries(loadedItems.items, ignoredEntries),
);
console.log(`[UpdateCenter] after applying ignored: items=${items.length}`);
queue.setItems(items);
queue.finishRefresh(loadedItems.warnings);
return emit();
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
console.error(`[UpdateCenter] refresh error:`, error);
queue.setItems([]);
applyWarning(message);
return emit();