Files
ChatLab/apps/cli
diguaandClaude Opus 4.8 7c21d1c879 feat(logging): add unified app logger with file rotation and global error capture
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>
2026-06-24 15:28:09 +08:00
..
2026-06-24 00:02:01 +08:00