TypeScript icon, indicating that this package has built-in type declarations

1.3.3 • Public • Published


An isomorphic, opinionated logging library that focuses on:

  • Simplicity: zero runtime dependencies, ~500 LoCs
  • Readability: produces plain-text, human-readable output
  • Performance: uses asynchronous logging techniques when possible
  • Child loggers: supports chained child loggers using prefix concatenation
  • Isomorphism: supports browsers and server-side runtimes
  • ESM: ships with separate ESM and CommonJS builds


In many areas this library stands opposite to pino, hence the name.


forms nouns from nouns, denoting a diminutive



Within ES modules

import pinetto from 'pinetto';

Within CommonJS modules

const { default: pinetto } = require('pinetto');

Basic usage

const logger = pinetto({ level: 'debug' });
const child = logger.child('child-prefix');'Hello, world!'); // prints hello world
child.debug('Hello, world!'); // prints hello world

logger.level = 'warn';        // log level can be changed at runtime
                              // the change propagates to child loggers'Hello, world!');  // prints nothing

Supported options

const logger = pinetto({
  level: 'debug',
  writer: new BufferedWriter(),
  prefixSeparator: '',
Option Description Default value
level Starting log level, one of "trace", "debug", "info", "warn", "error" "info"
writer Log writer function (see below) Depends on the environment
prefixSeparator A string that is used to concatenate prefixes in chain of child loggers " "


printf-style syntax is supported:

const logger = pinetto({ level: 'debug' });'Hello, %s!', 'World');

Log writers

Pinetto ships with two different writers: ConsoleWriter and BufferedWriter. The former falls back onto standard console logging methods while the latter flushes log entries to either console.log() or process.stdout.write() in an asynchronous fashion, depending on whether a node-like environment is detected.

By default, pinetto will use BufferedWriter in node-like environments and ConsoleWriter everywhere else. However, the writer can be manually set via the respective constructor option:

import pinetto, { ConsoleWriter, BufferedWriter } from 'pinetto';

const logger = pinetto({ level: 'debug', writer: new ConsoleWriter() });


Pinetto is released under the MIT license.

The following packages have been vendored into pinetto, although slowly diverging from the respective sources:

Package Sidebar


npm i pinetto

Weekly Downloads






Unpacked Size

46.3 kB

Total Files


Last publish


  • jacoscaz