image

Node.js logging libraries

Notable libraries to write logs in Node.js applications

Getting started with JavaScript and logging your first line using console.log is quick, but when you take your code to production, there's much more you should consider about logging:

  • Output formats (string, json, files, streams, etc.)
  • Different log levels for different log categories
  • Multiple configurable writable streams
  • Interactive and regular modes
  • String interpolation support
  • Configurable log rolling based on file size or date

winston

image

github.com

Winston is designed to be a simple and universal logging library with support for multiple transports. A transport is essentially a storage device for your logs.

bunyan

image

github.com

Bunyan is a simple and fast JSON logging library for node.js services, extensible streams system for controlling where log records go.

morgan

image

github.com

HTTP request logger middleware for node.js

debug

image

github.com

A tiny JavaScript debugging utility modelled after Node.js core's debugging technique. Works in Node.js and web browsers

signale

image

github.com

Signale can be used for logging purposes, status reporting, as well as for handling the output rendering process of other node modules and applications.

log4js

image

github.com

This is a conversion of the log4js framework to work with node. I started out just stripping out the browser-specific code and tidying up some of the javascript to work better in node

loglevel

image

github.com

Minimal lightweight logging for JavaScript, adding reliable log level methods to wrap any available console.log methods

npmlog

image

github.com

The logger util that npm uses, very basic, supports custom levels and colored output, all logs written to stderr by default.