Skip to content

[FEAT]: Integrate System Logs Across Application #117

@coxmars

Description

@coxmars

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/prisma error 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.error with 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 SystemLog entries
  • 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

⚠️ Follow issue, commit, and PR description guidelines — otherwise will be ignored.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions