-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Labels
Description
Integrate System Logs Across Application
Description
Implement comprehensive system logging by integrating with the System Logs API.
Add a centralized logging service for user actions, errors, and system events to improve monitoring and debugging.
Requirements
Centralized Logging Service
- Create
src/lib/services/logger.ts→ main logging service - Async logging with graceful error handling
- Use Prisma +
@/lib/prismaerror handling patterns - Follow service structure similar to
email-service.ts
Integration Points
- Authentication → login, registration, OAuth, role assignment
- Payouts → creation, updates, status changes, deletions
- Profiles → updates, avatar uploads, role changes
- Files → uploads + errors
- Database → connection issues, constraint violations, query failures
API Route Updates
-
src/app/api/(auth)/*→ add auth logs -
src/app/api/(payout)/*→ add payout logs -
src/app/api/(helper)/files/*→ add file logs - Replace all
console.errorwith structured logger
Components
src/lib/services/logger.ts(new)- Update 9 API routes with logging integration
Validations
- Logging service works async, non-blocking
- Failed logs don’t break app flow
- Logs include user context + metadata
- API response formats remain unchanged
- DB performance unaffected
Tests
- Service → logger creates
SystemLogentries - Integration → API routes log events without breaking
- Error → logging failures handled gracefully
- Performance → async logging doesn’t impact response time
- Data → metadata/context captured accurately
Reactions are currently unavailable