Winston

A battle-tested Node.js logging library with pluggable transports, custom formats, and multiple log levels.

Library
npm
v3.19.0
24,519 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
60 /100 Good
Development Activity 36
Maintenance 36
Community 68
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
81 /100 Excellent
Architecture 85
Code Quality 82
Innovation 78
Learning Curve 80

Winston is one of the most widely used logging libraries in the Node.js ecosystem, providing a single, consistent API for capturing application logs regardless of where they ultimately end up. Rather than hard-coding console output or file writes, developers configure one or more transports — Console, File, HTTP, or a wide range of community-maintained targets like Elasticsearch, Loggly, or CloudWatch — and let Winston route formatted log records to all of them simultaneously.

Built around Node’s stream primitives, Winston decouples log level filtering, structured metadata, and output formatting (via the companion logform package) from the underlying storage mechanism. This makes it straightforward to run different formats and levels per transport, attach default request-scoped metadata to child loggers, and centrally handle uncaught exceptions and unhandled promise rejections without scattering try/catch blocks throughout an application.

What You Get

  • A createLogger() factory producing loggers with npm-standard (or fully custom) severity levels and per-instance formatting.
  • Built-in Console, File, HTTP, and Stream transports, plus a stable transport interface for third-party targets.
  • Composable formats via the logform package — JSON, printf-style, colorization, timestamps, and error-stack handling.
  • Centralized exception and unhandled-rejection handlers, child loggers for per-request metadata, and a lightweight profiler for timing operations.

Common Use Cases

  • Structured JSON logging for services that ship logs to a centralized aggregator (ELK, Datadog, CloudWatch).
  • Multi-destination logging where errors go to a dedicated error.log/alerting transport and everything else goes to a combined log or console.
  • Request-scoped logging in web APIs using logger.child() to automatically attach a request ID to every log line.
  • Capturing uncaught exceptions and unhandled promise rejections as structured log entries instead of crashing silently.

Under The Hood

Architecture Winston’s core is lib/winston/logger.js, a Logger class extending Node’s Transform stream in object mode. Log calls funnel through .log() or level-shortcut methods generated dynamically in lib/winston/create-logger.js (e.g. .info(), .warn()), which build an info object and call .write(). The _transform() method pushes each info through the configured format pipeline (from the companion logform package) and streams the result to every piped transport via Node’s native .pipe(), so transports (lib/winston/transports/{console,file,http,stream}.js) are just writable streams the Logger writes into. Cross-cutting concerns — exception handling (exception-handler.js), rejection handling (rejection-handler.js), timing (profiler.js), and multi-logger management (container.js) — are implemented as separate collaborator classes composed onto the Logger instance in configure(), keeping the core class focused on the write/pipe pathway.

Tech Stack Winston 3.19.0 is pure CommonJS JavaScript (99% JS, under 1% TypeScript typings in index.d.ts) targeting Node >=12. It depends on a small, purpose-built set of sibling packages from the same winstonjs org — logform (formatting), winston-transport (transport base class), triple-beam (shared Symbols), @dabh/diagnostics (debug logging) — plus readable-stream for consistent stream behavior across Node versions, async for transport iteration, safe-stable-stringify for safe JSON serialization, and @colors/colors for terminal coloring. The build toolchain uses Babel to produce a dist/ browser bundle from the same lib/ source, and Jest (with separate unit/integration configs) drives the test suite.

Code Quality The test suite is substantial and organized (test/unit/winston/**, test/integration/**), covering the logger core, each transport, exception/rejection handlers, the profiler, and the container across 36 test files, using Jest with assume for BDD-style assertions and std-mocks for capturing stdout/stderr. Code style is enforced via a shared ESLint config (@dabh/eslint-config-populist) and Prettier. Naming and structure are consistent (one file per concern under lib/winston/), though some methods (e.g. Logger.log()) branch heavily on arguments.length to preserve backward compatibility with winston@1/2 call signatures, trading some readability for API stability — a tradeoff the maintainers document explicitly in comments and the UPGRADE-3.0.md guide.

API Design The primary API surface — winston.createLogger({ level, format, transports }) plus dynamically generated level methods (.info(), .error(), etc.) — requires very little boilerplate to get started, and the README leads with a working quick-start example. Ergonomics are strong for common cases (logger.child() for scoped metadata, logger.profile() for timing) but the format system, while powerful, has a learning curve: composing format.combine(timestamp(), label(), myFormat) correctly requires understanding the mutable info object and Symbol-keyed properties (LEVEL, MESSAGE, SPLAT) from triple-beam, which isn’t obvious from casual API browsing. Extensive documentation (a 36KB README, a dedicated docs/transports.md, and 25+ runnable examples in examples/) substantially offsets this.

Used by 50 apps in this directory

TypeScript
95%
MIT

Actual

Invoicing Finance

29,186

Local-first personal finance with envelope budgeting, end-to-end encryption, and multi-device sync — no subscription required.

View details
93
Repo Health
85
Technical
73
Dependency
Built with
TypeScript 95%
Updated 4 days ago
TypeScript
82%
Other

AFFiNE

Collaboration · Note Taking · Productivity

73,040

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 82%
Rust 11%
Updated 5 days ago
TypeScript
72%
AGPL 3.0

APITable

Databases · Low Code Platforms

15,623

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
71
Repo Health
77
Technical
60
Dependency
Built with
TypeScript 72%
Java 22%
Updated 3 weeks ago
TypeScript
96%
Other

Amplication

AI Code Assistants · Automation · Developer Tools

16,015

Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.

View details
58
Repo Health
84
Technical
60
Dependency
Built with
TypeScript 96%
Updated 3 months ago
JavaScript
95%
MIT

AnythingLLM

AI Assistants · Automation · Developer Tools

66,533

The all-in-one AI platform for private document chat, no-code agents, and local LLMs with zero setup friction.

View details
90
Repo Health
78
Technical
64
Dependency
Built with
JavaScript 95%
Updated 6 days ago
JavaScript
100%
Other

Automatisch

Automation · No Code Platforms

13,979

Self-hosted, no-code workflow automation that keeps your data on your own servers—a privacy-first alternative to Zapier with 90+ integrations.

View details
49
Repo Health
78
Technical
62
Dependency
Built with
JavaScript 100%
Updated 7 months ago
TypeScript
96%
Other

Cal.diy

Scheduling

48,697

The 100% MIT-licensed, community-driven scheduling platform — self-host your own booking infrastructure with no enterprise strings attached.

View details
91
Repo Health
86
Technical
65
Dependency
Built with
TypeScript 96%
Updated 6 days ago
TypeScript
98%
AGPL 3.0

Checkmate

Analytics · Devops · Monitoring

10,895

Self-hosted uptime and infrastructure monitoring with multi-protocol checks, global geo-coverage, and beautiful real-time dashboards.

View details
90
Repo Health
82
Technical
67
Dependency
Built with
TypeScript 98%
Updated 1 weeks ago
TypeScript
99%
AGPL 3.0

Cherry Studio

AI Assistants

52,202

All-in-one AI desktop client with 300+ assistants and multi-model support

View details
89
Repo Health
84
Technical
70
Dependency
Built with
TypeScript 99%
Updated 4 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers