Skip to content

feat: error and logging middleware#72

Merged
04shubham7 merged 1 commit intoOPCODE-Open-Spring-Fest:mainfrom
indrasuthar07:logging-middleware
Nov 12, 2025
Merged

feat: error and logging middleware#72
04shubham7 merged 1 commit intoOPCODE-Open-Spring-Fest:mainfrom
indrasuthar07:logging-middleware

Conversation

@indrasuthar07
Copy link
Copy Markdown
Contributor

Description

Implemented a centralized logging and error handling system for the backend.

Key Updates

  • Integrated Winston for structured logging (multi-level + file & console outputs)

  • Added request logger middleware for HTTP method, URL, status, and response time

  • Enhanced error handler with custom AppError class and detailed Mongoose/JWT error handling

  • Replaced all console.log statements with the new logger

  • separate log files created when finds an error

         error.log - errors only 
         combined.log - all logs 
         exceptions.log - unhandled exceptions 
         rejections.log - unhandled promise rejections
    
  • Updated .gitignore to exclude log files

Give a brief description of the pull request.

Semver Changes

  • Patch (bug fix, no new features)
  • Minor (new features, no breaking changes)
  • Major (breaking changes)

Issues

closes #14

List any issues that this pull request closes.

Checklist

Copy link
Copy Markdown
Member

@04shubham7 04shubham7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Fine

@04shubham7 04shubham7 self-assigned this Nov 12, 2025
@04shubham7 04shubham7 merged commit eb75aaa into OPCODE-Open-Spring-Fest:main Nov 12, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add Logging and Error Middleware

2 participants