Skip to content

chore: setup Winston/Morgan logging and standardize application logs (#35)#132

Open
gidadoabdullateef5 wants to merge 4 commits intoStellarFlow-Network:mainfrom
gidadoabdullateef5:chore/issue-35-winston-morgan-logging
Open

chore: setup Winston/Morgan logging and standardize application logs (#35)#132
gidadoabdullateef5 wants to merge 4 commits intoStellarFlow-Network:mainfrom
gidadoabdullateef5:chore/issue-35-winston-morgan-logging

Conversation

@gidadoabdullateef5
Copy link
Copy Markdown

PR: Setup Winston/Morgan Logging (#35)

📋 Summary

Standardized the backend logging infrastructure by migrating from raw console calls to a centralized, structured logging system using Winston and Morgan.


🚀 Proposed Changes

1. 🏗️ Infrastructure Setup

  • Added winston for professional, file-based structured logging.
  • Integrated morgan for automated HTTP request logging.
  • Configured log rotation and persistence in the logs/ directory.

2. 🧹 Codebase Migration

Replaced over 50+ instances of console.log, console.error, and console.warn with:

  • logger.info(): General application flow.
  • logger.error(): Internal errors and transaction failures.
  • logger.warn(): Performance alerts and fallback triggers.

3. 🛡️ Affected Services

  • Market Rates: marketRateService.ts, KES/GHS/NGN fetchers.
  • Stellar Integration: stellarService.ts, sorobanEventListener.ts.
  • Security & Infrastructure: apiKeyMiddleware.ts, socket.ts, webhook.ts.

✅ Verification Implementation

Professional Log Format (JSON)

{"level":"info","message":"🌊 Backend running on port 3000","service":"stellarflow-backend","timestamp":"2026-03-29T07:57:40.534Z"}
# PR: Setup Winston/Morgan Logging (#35)

## 📋 Summary
Standardized the backend logging infrastructure by migrating from raw `console` calls to a centralized, structured logging system using **Winston** and **Morgan**.

---

## 🚀 Proposed Changes

### 1. 🏗️ Infrastructure Setup
- Added `winston` for professional, file-based structured logging.
- Integrated `morgan` for automated HTTP request logging.
- Configured log rotation and persistence in the `logs/` directory.

### 2. 🧹 Codebase Migration
Replaced over 50+ instances of `console.log`, `console.error`, and `console.warn` with:
- `logger.info()`: General application flow.
- `logger.error()`: Internal errors and transaction failures.
- `logger.warn()`: Performance alerts and fallback triggers.

### 3. 🛡️ Affected Services
- **Market Rates**: [marketRateService.ts](cci:7://file:///c:/BACKUP/former/Hackathon/stellar-flow-backend/stellarflow-backend/src/services/marketRate/marketRateService.ts:0:0-0:0), `KES/GHS/NGN` fetchers.
- **Stellar Integration**: [stellarService.ts](cci:7://file:///c:/BACKUP/former/Hackathon/stellar-flow-backend/stellarflow-backend/src/services/stellarService.ts:0:0-0:0), `sorobanEventListener.ts`.
- **Security & Infrastructure**: `apiKeyMiddleware.ts`, `socket.ts`, [webhook.ts](cci:7://file:///c:/BACKUP/former/Hackathon/stellar-flow-backend/stellarflow-backend/src/services/webhook.ts:0:0-0:0).

---

## ✅ Verification Implementation

### Professional Log Format (JSON)
```json
{"level":"info","message":"🌊 Backend running on port 3000","service":"stellarflow-backend","timestamp":"2026-03-29T07:57:40.534Z"}

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

Hey @gidadoabdullateef5! 👋 It looks like this PR isn't linked to any issue.

If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g., Closes #123), or by clicking a button below:

Issue Title
#35 [Chore] Setup Winston/Morgan Logging Link to this issue

ℹ️ Learn more about linking PRs to issues

Copy link
Copy Markdown
Author

@gidadoabdullateef5 gidadoabdullateef5 left a comment

Choose a reason for hiding this comment

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

I just resolved the complete. Kindly review, so the issue can be closed

Copy link
Copy Markdown
Author

@gidadoabdullateef5 gidadoabdullateef5 left a comment

Choose a reason for hiding this comment

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

Just resolved a merge conflict, kindly review, so the issue can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant