Winston
A battle-tested Node.js logging library with pluggable transports, custom formats, and multiple log levels.
Repository Health
Technical Analysis
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
logformpackage — 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
PeerTube
Social Media
A federated, ActivityPub-based video hosting platform built by Framasoft — self-hostable instances interconnect into a network with no vendor lock-in, P2P-assisted streaming, and no ads.
Plane
Collaboration · Productivity · Project Management
Open-source project management platform to replace Jira, Linear, and ClickUp — with built-in cycles, real-time collaborative docs, and full self-hosting.
Plasmic
CMS · Design Tools · Low Code Platforms
The open-source visual builder that lets teams design React apps and websites with drag-and-drop while integrating seamlessly with your codebase.
Promptfoo
AI Development
An open-source CLI and library for evaluating and red-teaming LLM applications — replace trial-and-error prompt engineering with systematic evals, vulnerability scanning, and CI/CD integration.
QRev
AI Agents · CRM
Open source AI-first sales platform that replaces Salesforce with autonomous agents handling prospecting, outreach, and lead management at scale.
RSSHub
Automation · Social Media
Turn any website into an RSS feed — social media, streaming platforms, and niche sites all become subscribable in seconds.
Sourcebot
AI Code Assistants · Developer Tools · Search
A self-hosted, AI-powered code search engine that indexes every repo across GitHub, GitLab, Bitbucket, Gitea, Gerrit, and Azure DevOps, so both engineers and coding agents can search, browse, and ask questions about your codebase from one place.
strapi
CMS
Open-source headless CMS that auto-generates REST and GraphQL APIs from your content models, with a fully customizable admin panel you control.
Teleport
Authentication · Security
Zero-trust infrastructure access platform that replaces credentials and VPNs with short-lived certificates, SSO, and identity-aware proxies for SSH, Kubernetes, databases, RDP, and AI agents.