feat(logging-p0): add full-step logging to ERP automation and unify capturePageContext

Add ~45 structured log calls across extractor-core, cleaner, and erp-auth
to cover all automation steps (navigation, query, download, material processing).
Enhance capturePageContext with a step parameter for precise failure localization,
and fix missing capturePageContext calls in error handlers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-04-04 13:19:41 +08:00
parent 219d8ab752
commit c8783a2cef
4 changed files with 76 additions and 9 deletions

View File

@@ -11,6 +11,7 @@ export interface ErpErrorContext {
pageUrl?: string
frameHierarchy?: Array<{ name: string; url: string }>
targetSelector?: string
step?: string
}
/**
@@ -22,7 +23,8 @@ export interface ErpErrorContext {
*/
export async function capturePageContext(
page: Page,
targetSelector?: string
targetSelector?: string,
step?: string
): Promise<ErpErrorContext> {
const ctx: ErpErrorContext = {}
@@ -43,5 +45,9 @@ export async function capturePageContext(
ctx.targetSelector = targetSelector
}
if (step) {
ctx.step = step
}
return ctx
}