Convert Figma logo to code with AI

pinojs logopino

🌲 super fast, all natural json logger

13,957
861
13,957
110

Top Related Projects

A port of log4js to node.js

22,612

A logger for just about everything.

a simple and fast JSON logging module for node.js services

7,911

HTTP request logger middleware for node.js

11,101

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

8,911

Highly configurable logging utility

Quick Overview

Pino is a super fast, low overhead Node.js logger. It's designed to be simple to use and highly performant, making it ideal for both development and production environments. Pino focuses on JSON logging for easy parsing and analysis.

Pros

  • Extremely fast performance with minimal overhead
  • JSON output for easy machine parsing
  • Supports child loggers for request contexts
  • Extensible through plugins and transport streams

Cons

  • Less human-readable output compared to some other loggers
  • Requires additional tooling for pretty-printing in development
  • Limited built-in formatting options
  • Steeper learning curve for advanced features

Code Examples

Basic logging:

const pino = require('pino')
const logger = pino()

logger.info('Hello world')
logger.error('This is an error!')

Using child loggers:

const logger = require('pino')()
const child = logger.child({ a: 'property' })
child.info('hello child!')
// Output: {"level":30,"time":..,"pid":...,"hostname":"...","a":"property","msg":"hello child!"}

Customizing log levels:

const customLogger = pino({
  customLevels: {
    foo: 35
  },
  useOnlyCustomLevels: true,
  level: 'foo'
})

customLogger.foo('bar')

Getting Started

  1. Install Pino:

    npm install pino
    
  2. Create a basic logger:

    const pino = require('pino')
    const logger = pino()
    
    logger.info('Hello Pino!')
    logger.error('This is an error message')
    
  3. Run your Node.js application, and you'll see JSON log output in the console.

Competitor Comparisons

A port of log4js to node.js

Pros of log4js-node

  • More flexible configuration options, including XML and JSON formats
  • Supports a wider range of appenders out of the box
  • Easier to set up and use for developers familiar with log4j

Cons of log4js-node

  • Generally slower performance compared to Pino
  • Larger package size and more dependencies
  • Less focus on JSON logging, which can be important for modern applications

Code Comparison

log4js-node:

const log4js = require('log4js');
log4js.configure({
  appenders: { cheese: { type: 'file', filename: 'cheese.log' } },
  categories: { default: { appenders: ['cheese'], level: 'error' } }
});
const logger = log4js.getLogger('cheese');
logger.error('Cheese is too ripe!');

Pino:

const pino = require('pino');
const logger = pino({ level: 'error' }, pino.destination('cheese.log'));
logger.error('Cheese is too ripe!');

Both log4js-node and Pino are popular logging libraries for Node.js, each with its own strengths. log4js-node offers more configuration options and a familiar interface for those coming from log4j, while Pino focuses on high-performance JSON logging. The choice between them often depends on specific project requirements and performance needs.

22,612

A logger for just about everything.

Pros of Winston

  • More flexible and customizable with multiple transports and formatters
  • Extensive ecosystem with numerous plugins and integrations
  • Supports querying and filtering of logs

Cons of Winston

  • Generally slower performance compared to Pino
  • More complex setup and configuration
  • Larger bundle size and memory footprint

Code Comparison

Winston:

const winston = require('winston');
const logger = winston.createLogger({
  level: 'info',
  format: winston.format.json(),
  transports: [new winston.transports.Console()]
});
logger.info('Hello, Winston!');

Pino:

const pino = require('pino');
const logger = pino();
logger.info('Hello, Pino!');

Winston offers more built-in configuration options, while Pino provides a simpler, more streamlined API. Winston's flexibility comes at the cost of performance, whereas Pino prioritizes speed and low overhead.

Both loggers are popular choices in the Node.js ecosystem, with Winston being more established and feature-rich, while Pino focuses on high-performance logging. The choice between them depends on specific project requirements, such as the need for extensive customization (Winston) or maximum performance (Pino).

a simple and fast JSON logging module for node.js services

Pros of Bunyan

  • More mature project with longer history and established ecosystem
  • Built-in support for multiple output streams
  • Includes a CLI tool for pretty-printing and querying logs

Cons of Bunyan

  • Generally slower performance compared to Pino
  • Less active development and fewer recent updates
  • Larger bundle size and more dependencies

Code Comparison

Bunyan:

const bunyan = require('bunyan');
const log = bunyan.createLogger({name: 'myapp'});
log.info('Hello, world!');

Pino:

const pino = require('pino');
const logger = pino();
logger.info('Hello, world!');

Both Pino and Bunyan are popular logging libraries for Node.js applications. Pino is known for its high performance and low overhead, making it an excellent choice for applications where speed is crucial. It's also more actively maintained and has a smaller footprint.

Bunyan, while slightly slower, offers more built-in features out of the box, such as multiple output streams and a CLI tool. It has a longer history and a well-established ecosystem of plugins and integrations.

In terms of basic usage, both libraries have similar syntax for creating loggers and logging messages. The main differences become apparent in more advanced configurations and performance-critical scenarios.

Ultimately, the choice between Pino and Bunyan depends on specific project requirements, with Pino being favored for high-performance needs and Bunyan for its additional features and mature ecosystem.

7,911

HTTP request logger middleware for node.js

Pros of Morgan

  • Simpler setup and configuration for basic logging needs
  • Built-in support for common logging formats (e.g., combined, common, dev)
  • Seamless integration with Express.js applications

Cons of Morgan

  • Limited customization options for log output
  • Lacks built-in support for log levels and structured logging
  • Performance may be slower compared to Pino for high-throughput applications

Code Comparison

Morgan:

const express = require('express');
const morgan = require('morgan');
const app = express();

app.use(morgan('combined'));

Pino:

const express = require('express');
const pino = require('pino-http')();
const app = express();

app.use(pino);

Both Morgan and Pino are popular logging solutions for Node.js applications, but they cater to different needs. Morgan is simpler to set up and use, especially for Express.js applications, while Pino offers more advanced features like structured logging and better performance for high-throughput scenarios. The choice between the two depends on the specific requirements of your project, such as the need for customization, performance, or integration with existing Express.js applications.

11,101

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

Pros of debug

  • Simpler API with minimal setup required
  • Built-in support for browser environments
  • Lightweight with no dependencies

Cons of debug

  • Limited formatting options and log levels
  • Lacks structured logging capabilities
  • No built-in support for asynchronous logging

Code Comparison

debug:

const debug = require('debug')('myapp');
debug('Hello, %s', 'world');

pino:

const pino = require('pino')();
pino.info('Hello, %s', 'world');

Summary

debug is a lightweight debugging utility with a simple API, making it easy to use for basic logging needs, especially in browser environments. However, it lacks advanced features like structured logging and multiple log levels.

pino, on the other hand, offers more robust logging capabilities, including structured logging, multiple log levels, and better performance for high-throughput applications. It's more suitable for complex server-side applications but requires more setup and has a steeper learning curve.

Choose debug for simple debugging tasks or browser-based logging, and pino for more comprehensive server-side logging needs with better performance and flexibility.

8,911

Highly configurable logging utility

Pros of Signale

  • More visually appealing output with colorful icons and formatting
  • Supports custom loggers with predefined styles and scopes
  • Offers interactive logging capabilities (e.g., spinners, timers)

Cons of Signale

  • Generally slower performance compared to Pino
  • Less focused on pure logging; includes additional features that may not be necessary for all use cases
  • Not as well-suited for high-performance, production-level logging

Code Comparison

Signale:

const signale = require('signale');
signale.success('Operation successful');
signale.error('Error occurred');
signale.warn('Warning message');

Pino:

const pino = require('pino')();
pino.info('Operation successful');
pino.error('Error occurred');
pino.warn('Warning message');

Summary

Signale offers a more visually rich logging experience with additional features like interactive logging and custom loggers. However, it may not be as performant or focused on pure logging as Pino. Pino is better suited for high-performance, production-level logging, while Signale excels in development environments where visual appeal and additional features are valued. The choice between the two depends on the specific needs of the project, balancing between aesthetics and performance.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

banner

pino

npm version Build Status js-standard-style

Very low overhead Node.js logger.

Documentation

Install

Using NPM:

$ npm install pino

Using YARN:

$ yarn add pino

If you would like to install pino v6, refer to https://github.com/pinojs/pino/tree/v6.x.

Usage

const logger = require('pino')()

logger.info('hello world')

const child = logger.child({ a: 'property' })
child.info('hello child!')

This produces:

{"level":30,"time":1531171074631,"msg":"hello world","pid":657,"hostname":"Davids-MBP-3.fritz.box"}
{"level":30,"time":1531171082399,"msg":"hello child!","pid":657,"hostname":"Davids-MBP-3.fritz.box","a":"property"}

For using Pino with a web framework see:

Essentials

Development Formatting

The pino-pretty module can be used to format logs during development:

pretty demo

Transports & Log Processing

Due to Node's single-threaded event-loop, it's highly recommended that sending, alert triggering, reformatting, and all forms of log processing are conducted in a separate process or thread.

In Pino terminology, we call all log processors "transports" and recommend that the transports be run in a worker thread using our pino.transport API.

For more details see our Transports⇗ document.

Low overhead

Using minimum resources for logging is very important. Log messages tend to get added over time and this can lead to a throttling effect on applications – such as reduced requests per second.

In many cases, Pino is over 5x faster than alternatives.

See the Benchmarks document for comparisons.

Bundling support

Pino supports being bundled using tools like webpack or esbuild.

See Bundling document for more information.

The Team

Matteo Collina

https://github.com/mcollina

https://www.npmjs.com/~matteo.collina

https://twitter.com/matteocollina

David Mark Clements

https://github.com/davidmarkclements

https://www.npmjs.com/~davidmarkclements

https://twitter.com/davidmarkclem

James Sumners

https://github.com/jsumners

https://www.npmjs.com/~jsumners

https://twitter.com/jsumners79

Thomas Watson Steen

https://github.com/watson

https://www.npmjs.com/~watson

https://twitter.com/wa7son

Contributing

Pino is an OPEN Open Source Project. This means that:

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.

See the CONTRIBUTING.md file for more details.

Acknowledgments

This project was kindly sponsored by nearForm. This project is kindly sponsored by Platformatic.

Logo and identity designed by Cosmic Fox Design: https://www.behance.net/cosmicfox.

License

Licensed under MIT.

NPM DownloadsLast 30 Days