feat: structured-debug-logging — structured logging for LangGraph client and skills#261
feat: structured-debug-logging — structured logging for LangGraph client and skills#261avoidwork wants to merge 5 commits into
Conversation
Audit Results: structured-debug-loggingGoal FulfillmentGoal 1 (Config-Driven Logging Infrastructure): ✅ COMPLETE
Goal 2 (LangGraph Stream Event Logging): ✅ COMPLETE
Goal 3 (LangGraph Invoke Path Logging): ✅ COMPLETE
Goal 4 (Skill Execution Logging): ✅ COMPLETE
Goal 5 (Testing): ✅ COMPLETE
Goal 6 (Verification): ⏳ MANUAL (not automated)
Spec ComplianceAll spec requirements met:
Task CompletionAll 24 tasks completed:
Quality Check
Deviations from Original PlanNone. Implementation matches the spec and design documents exactly. |
|
This PR introduces a second, independent logger instance in alongside the existing . Having two separate pino logger instances with their own file handles, flush mechanisms, and configuration is an incorrect architectural solution. The proper approach is to extend the existing logger in with the structured logging capabilities (event handlers, config-driven levels, etc.) rather than creating a parallel logging system. This keeps a single source of truth for logging, avoids duplicate file handles, and ensures consistent shutdown/flush behavior. Closing this PR — please resubmit as an enhancement to instead. |
Description
Add structured, config-driven logging for LangGraph client events (tool calls, LLM responses, errors) and skill execution. Introduces a
loggingsection inconfig.yamlwith configurable log level (default: "info"), createssrc/logging/config.js(config-driven pino logger factory) andsrc/logging/handlers.js(stream event handlers), and instrumentssrc/agent/react.jsandsrc/skills/registry.jswith structured logging.Type of Change
Testing
src/logging/config.js: 16 tests covering default level, custom levels, invalid level fallback, singleton methodssrc/logging/handlers.js: 22 tests covering all event handlers, wrapCallback, tool duration trackingCoverage
Checklist
npm run lintpassesThreat Model
Files Changed
config.yaml— addedloggingsection withlevel: infoandformat: jsonsrc/config/schemas.js— addedLoggingSchemawith level and format enumssrc/logging/config.js— NEW: config-driven pino logger factory with OS-aware log directory, dual-file output, test suppressionsrc/logging/handlers.js— NEW: event handler factory for LangGraph stream events (tool_start/end/error, llm_response/error, compaction)src/agent/react.js— instrumentedcallReactAgentStreaming()andcallReactAgent()with structured loggingsrc/skills/registry.js— instrumentedget()method with skill execution loggingtests/unit/logging/config.test.js— NEW: 16 unit tests for logger factorytests/unit/logging/handlers.test.js— NEW: 22 unit tests for event handlersopenspec/specs/structured-logging/spec.md— archived spec with 4 requirements