@alwatr/logger
TypeScript icon, indicating that this package has built-in type declarations

3.2.7 • Public • Published

Logger

Fancy colorful console debugger with custom scope written in tiny TypeScript, ES module.

Example usage

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

const logger = createLogger('demo');

function sayHello(name: string) {
  logger.logMethodArgs?.('sayHello', {name});
}

Debug/Develope Mode (DEBUG_MODE)

Many of the methods in the logger are no-ops when the debug mode is off. This is to prevent unnecessary performance impact in production.

Browser

window.localStorage?.setItem('debug', '1');

// Please remember to **reload** the window after changing the debug mode.

Make sure the log level in set correctly.

CLI

DEBUG=1 node index.js

Package Sidebar

Install

npm i @alwatr/logger

Weekly Downloads

299

Version

3.2.7

License

MIT

Unpacked Size

38.3 kB

Total Files

17

Last publish

Collaborators

  • njfamirm
  • alimd