Skip to content

feat: Add logging API for KIR and LUCY with error handling and logging services

Abhishek Paspunuri requested to merge api_feature_loggers-kir-lucy into dev

PR Type

Enhancement


Description

  • Add logging API endpoints for KIR and LUCY systems

  • Implement comprehensive error handling with structured logging

  • Create dedicated service layers for log fetching

  • Remove deprecated LUCY contact endpoint


Diagram Walkthrough

flowchart LR
  A["API Routes"] --> B["KIR Logs API"]
  A --> C["LUCY Logs API"]
  B --> D["KIR Logs Service"]
  C --> E["LUCY Logs Service"]
  D --> F["Database (KIRLogs)"]
  E --> G["Database (LucyLogs)"]
  B --> H["Logger Service"]
  C --> H
  D --> H
  E --> H

File Walkthrough

Relevant files
Enhancement
route.ts
Add KIR logs API route                                                                     

src/app/api/kir/logs/route.ts

  • Create new API route for KIR logs
  • Export GET handler from logs API module
+1/-0     
route.ts
Add LUCY logs API route                                                                   

src/app/api/lucy/logs/route.ts

  • Create new API route for LUCY logs
  • Export GET handler from logs API module
+1/-0     
logsApi.ts
Implement KIR logs API handler                                                     

src/server/apis/kir/logsApi.ts

  • Implement GET handler for KIR logs with Prisma context
  • Add comprehensive error handling with structured logging
  • Use constants for error messages and HTTP status codes
+31/-0   
logsApi.ts
Implement LUCY logs API handler                                                   

src/server/apis/lucy/logsApi.ts

  • Implement GET handler for LUCY logs with Prisma context
  • Add comprehensive error handling with structured logging
  • Use constants for error messages and HTTP status codes
+31/-0   
logs.service.ts
Add KIR logs service layer                                                             

src/server/services/kir/logs.service.ts

  • Create service to fetch KIR logs from database
  • Add logging for successful operations and errors
  • Implement ordered query with limit of 100 records
+29/-0   
logs.service.ts
Add LUCY logs service layer                                                           

src/server/services/lucy/logs.service.ts

  • Create service to fetch LUCY logs from database
  • Add logging for successful operations and errors
  • Implement ordered query by ID descending
+25/-0   
Miscellaneous
route.ts
Remove LUCY contact API                                                                   

src/app/api/lucy/contact/route.ts

  • Remove entire contact API implementation
  • Delete GET handler for contacts endpoint
+0/-16   

Edited by Rashmi Gaddam

Merge request reports

Loading