2.0.1 • Published 5 months ago

@evilkiwi/logger v2.0.1

Weekly downloads
-
License
GPL-3.0-only
Repository
github
Last release
5 months ago

@evilkiwi/logger provides a small interface on top of the existing console API and includes things such as:

  • Automatic code highlighting via `template literal` syntax
  • High-precision timestamps
  • Namespacing and Instanced Loggers
  • Enable/disable logging at runtime

Installation

This package is available via NPM:

yarn add @evilkiwi/logger

# or

npm install @evilkiwi/logger

Usage

Since version 2.0.0, there are no global logger exports. Instead, you must always create a logger instance:

import { createLogger } from '@evilkiwi/logger';

const loggerA = createLogger({
  name: 'module-a',
  color: '#FF0000',
});
const loggerB = createLogger({
  name: 'module-b',
  color: '#00FF00',
});

loggerA.debug('hello world A!');
loggerA.error('hello world B!');