Skip to content

Getting started


Install with:

npm i leekslazylogger
yarn add leekslazylogger

And require it in your code:

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


Logger instances in the same process share options. Additional logger instances (if you create more in other files) will have the same log functions.

For options, see Customisation/Options.

Basic usage

Each log type (default or custom) can be used like this:

log.type(text [, colours]); // colour overrides are optional

Examples'Hello world');

log.console('Ready.', ['magentaBright']);

log.console(log.format('Status: &aonline'));

A list of the default log types can be found here. Look at this page for information about custom log types.

Colour overrides

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

This will colour the entire line, including the timestamp & title. foreground and background should be a resolvable colour.

Inline colours

Use the log.format() function to colour text using &codes;

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


You can use Logger#f() too.

Last update: October 13, 2020