From 925b3937790e060a973bcda8f9c56828946fde4c Mon Sep 17 00:00:00 2001 From: Filip Malinowski Date: Sun, 30 Jan 2022 19:32:24 +0100 Subject: [PATCH] feat!: publish mini-console-logger v3 rewritten with TypeScript --- packages/mini-console-logger/README.md | 40 +++++++++++++++++++++++ packages/mini-console-logger/package.json | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/packages/mini-console-logger/README.md b/packages/mini-console-logger/README.md index e69de29..8937f4a 100644 --- a/packages/mini-console-logger/README.md +++ b/packages/mini-console-logger/README.md @@ -0,0 +1,40 @@ +# mini-console-logger + +[![npm latest](https://img.shields.io/npm/v/mini-console-logger)](https://www.npmjs.com/package/mini-console-logger) +[![npm prerelease](https://img.shields.io/npm/v/mini-console-logger/next?color=orange)](https://www.npmjs.com/package/mini-console-logger) +![module formats: es, cjs](https://img.shields.io/badge/module%20formats-es%2C%20cjs-green) + +Simple logging utility. + +``` +npm install mini-console-logger --save +``` + +## Usage + +```js +import logger, { LOG_LEVELS } from 'mini-console-logger'; + +logger.trace('trace'); +logger.debug('debug'); +logger.info('info'); +logger.warn('warn'); +logger.error('error'); + +// objects and Errors are stringified automatically +logger.debug({ + prop1: 'foo', + prop2: 'bar' +}); +logger.error(new Error('foo')); + +logger.level = null; // silence logger +logger.level = LOG_LEVELS.WARN; // log only warn and above + +logger.on(LOG_LEVELS.ERROR, err => { + // do something with the error +}); +logger.off(LOG_LEVELS.ERROR); // unbind error listener +``` + +[Live demo](http://jsbin.com/cawiwep/edit?js,console) diff --git a/packages/mini-console-logger/package.json b/packages/mini-console-logger/package.json index f8a25f4..1f76f1e 100644 --- a/packages/mini-console-logger/package.json +++ b/packages/mini-console-logger/package.json @@ -1,7 +1,7 @@ { "name": "mini-console-logger", "description": "Simple logging utility", - "version": "3.0.0", + "version": "2.1.0", "license": "", "repository": { "type": "git",