Skip to content

Comments

feat(logger): integrate Winston with console and file transports#304

Merged
Folex1275 merged 1 commit intoFolex1275:mainfrom
teethaking:main
Feb 25, 2026
Merged

feat(logger): integrate Winston with console and file transports#304
Folex1275 merged 1 commit intoFolex1275:mainfrom
teethaking:main

Conversation

@teethaking
Copy link
Contributor

Closes #246

Type of Change

  • New feature (non-breaking change which adds functionality)

What Changed

Replaces the previous console-based logger.ts with a professional Winston
implementation. The existing API is fully preserved — no other files need updating.

Transports

Transport When Active Output
Console Always Colorized, timestamped, human-readable
File: errors.log Production / LOG_TO_FILE=true JSON, error level only, 10MB × 5 rotations
File: combined.log Production / LOG_TO_FILE=true JSON, all levels, 20MB × 5 rotations

API — Backward Compatible

All existing call sites continue to work unchanged:

logger.debug("message", meta?)
logger.info("message", meta?)
logger.warn("message", meta?)
logger.error("message", error?, meta?)
logger.event("EVENT_TYPE", data)

What Improved vs Before

  • ✅ Color-coded levels — cyan info, yellow warn, red error
  • ✅ Timestamps in YYYY-MM-DD HH:mm:ss.SSS format
  • ✅ Error stacks automatically captured and structured
  • ✅ Persistent file logs in production with auto-rotation
  • ✅ Silent in NODE_ENV=test — no noisy test output
  • LOG_LEVEL env var controls verbosity without code changes

Environment Variables

Variable Default Description
LOG_LEVEL debug (dev) / info (prod) Minimum log level to output
LOG_TO_FILE false Enable file transport outside production
LOG_DIR <cwd>/logs Directory for log files

Checklist

  • I have read the CONTRIBUTING.md guidelines
  • My commits follow the Conventional Commits specification
  • My commits are atomic and represent singular logical changes
  • I have self-reviewed my own code
  • I have tested my changes locally and verified they pass linting and builds

@Folex1275 Folex1275 merged commit 7e3ee36 into Folex1275:main Feb 25, 2026
0 of 2 checks passed
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.

[Backend] Winston Logger Integration

2 participants