Files
supervisor-ui/package.json
Sebastian Krüger b252a0b3bf
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 1m50s
feat: implement comprehensive logging infrastructure (Phases 1-3)
Added production-ready logging using Pino with structured JSON output,
pretty printing in development, and automatic sensitive data redaction.

## Phase 1: Core Logger Setup
- Installed pino, pino-http, and pino-pretty dependencies
- Created logger utility (lib/utils/logger.ts):
  - Environment-based log levels (debug in dev, info in prod)
  - Pretty printing with colors in development
  - JSON structured logs in production
  - Sensitive data redaction (passwords, tokens, auth headers)
  - Custom serializers for errors and requests
  - Helper functions for child loggers and timing
- Added LOG_LEVEL environment variable to .env.example
- Configured Next.js for Turbopack with external pino packages

## Phase 2: API Request Logging
- Created API logger wrapper (lib/utils/api-logger.ts):
  - withLogging() HOF for wrapping API route handlers
  - Automatic request/response logging with timing
  - Correlation ID generation (X-Request-ID header)
  - Error catching and structured error responses
  - logPerformance() helper for timing operations
  - createApiLogger() for manual logging in routes

## Phase 3: Supervisor Client Logging
- Updated lib/supervisor/client.ts:
  - Added logger instance to SupervisorClient class
  - Comprehensive XML-RPC call logging (method, params, duration)
  - Error logging with full context and stack traces
  - Success logging with result size tracking
  - DEBUG level logs for all XML-RPC operations
  - Constructor logging for client initialization

## Configuration Changes
- Updated next.config.ts for Turbopack compatibility
- Added serverComponentsExternalPackages for pino
- Removed null-loader workaround (not needed)

## Features Implemented
 Request correlation IDs for tracing
 Performance timing for all operations
 Sensitive data redaction (passwords, auth)
 Environment-based log formatting
 Structured JSON logs for production
 Pretty colored logs for development
 Error serialization with stack traces
 Ready for log aggregation (stdout/JSON)

## Next Steps (Phases 4-7)
- Update ~30 API routes with logging
- Add React Query/hooks error logging
- Implement client-side error boundary
- Add documentation and testing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 20:44:46 +01:00

53 lines
1.4 KiB
JSON

{
"name": "supervisor-ui",
"version": "0.1.0",
"private": true,
"packageManager": "pnpm@10.20.0",
"scripts": {
"dev": "next dev",
"dev:turbo": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "next lint",
"lint:fix": "next lint --fix",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
"type-check": "tsc --noEmit"
},
"dependencies": {
"@tanstack/react-query": "^5.62.11",
"clsx": "^2.1.1",
"date-fns": "^4.1.0",
"lucide-react": "^0.468.0",
"next": "^16.0.1",
"pino": "^10.1.0",
"pino-http": "^11.0.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"recharts": "^2.15.0",
"sonner": "^1.7.1",
"tailwind-merge": "^2.5.5",
"xmlrpc": "^1.3.2",
"zod": "^3.24.1",
"zustand": "^5.0.2"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.9",
"@tailwindcss/postcss": "^4.1.17",
"@tailwindcss/typography": "^0.5.15",
"@types/node": "^22",
"@types/react": "^19",
"@types/react-dom": "^19",
"@types/xmlrpc": "^1.3.9",
"@typescript-eslint/eslint-plugin": "^8.46.3",
"@typescript-eslint/parser": "^8.46.3",
"eslint": "^9",
"eslint-config-next": "^16.0.1",
"null-loader": "^4.0.1",
"pino-pretty": "^13.1.2",
"postcss": "^8",
"prettier": "^3.4.2",
"tailwindcss": "^4.0.0",
"typescript": "^5"
}
}