Skip to content

Getting started

Installation

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. Omit options to use the defaults.

Basic usage

log[level](...content)
// or
log[level][namespace](...content)

Examples

Default levels
  • debug
  • verbose
  • info
  • success
  • warn
  • notice
  • error
  • critical
log.info('information', 'more information');
log.error('oops!', new Error('an error'));
log.debug('something happened!', { something: ['hello', 'world'] });
// in your options:
namespaces: ['commands', 'plugins', 'http']

// ...
log.error.commands('an error occurred during command execution')
log.success.plugins('loaded a plugin')
log.info.http('received a request from someone')

Last update: October 23, 2021