Skip to content

Getting started


Install with:

pnpm add leekslazylogger
npm i leekslazylogger
yarn add leekslazylogger

And require it in your code:

const Logger = require('leekslazylogger');
const log = new Logger(options);

For options, see customisation.

Basic usage

Each log level can be used like this:

log.<level>(text[, colours[, ...extra]]);
  • text should be the string you want to log
  • colours is an optional array of [foregroundColour, backgroundColour]
  • extra are optional extras (like console.log('some %s text', 'awesome', {anObject: true}))


log.console('Hello world');'Ready.', ['magentaBright']);'Status: &aonline'));

A list of the default log levels can be found here. See customisation for information about custom log levels.

Colour overrides

If you want to override the colours of a particular line you can do so like this:'useful information', [foreground, background]);

foreground and background should be a resolvable colour.

Inline colours

Use the Logger.format() function to colour text using short codes ("&codes"):

log.console(Logger.format('&2this is green &4and this is red'));


You can use Logger.f() too.

Last update: August 12, 2021