Skip to content

Improvement : Winston + Morgan Logging Setup #1285

@100NikhilBro

Description

@100NikhilBro

🛠 Winston + Morgan Logging Setup

Overview

This setup provides a production-ready logging solution for Express apps using Winston and Morgan. It includes:

  • Application-level logging with Winston
  • HTTP request logging with Morgan
  • Error logging and structured console output
  • Automatic log file creation

Folder Structure (Proposed)

src/
├── logger/
│   ├── winston.js
│   └── morgan.js
├── middlewares/
│   └── logging.middleware.js
├── index.js
  

Benefits

  • Structured logs with timestamps
  • Error tracking in separate files
  • HTTP request monitoring via Morgan
  • Simple, modular, and production-ready

Notes

  • Log files are automatically created inside logs/ folder
  • Console logs are visible during development and on servers
  • Can be extended for log rotation or external logging services

Metadata

Metadata

Assignees

Type

Projects

Status

assigned

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions