mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-26 02:04:37 +08:00
Build a shared appLogger (node-runtime) that all three runtimes write to a single rolling logs/app.log (10 MB → rename to app.old.log). Replaces the four independent hand-written loggers (app.log/api.log Electron wrappers) with a unified entry point while leaving AiLogger/perf-logger intact. Key additions: - packages/node-runtime/src/logging/app-logger.ts: initAppLogger/appLogger singleton, INFO threshold by default (CHATLAB_LOG_LEVEL to override), atomic rename rotation, Error data auto-extracts message+stack - Three-runtime init: Electron main, CLI Web (http/index.ts), CLI (run()) - Global crash capture: uncaughtException + unhandledRejection on all three Node runtimes now land in app.log scope 'crash' - Fastify setErrorHandler fallback logs scope 'http' on CLI Web and Electron internal server for unexpected 5xx errors - Frontend: window.onerror + unhandledrejection + Vue errorHandler feed into POST /_web/logs/report (scope 'web') with dedup+throttle - AGENTS.md: logging rules section requiring key-path logs on new/changed features Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>