Skip to content

Commit

Permalink
feat!: publish mini-console-logger v3
Browse files Browse the repository at this point in the history
rewritten with TypeScript
  • Loading branch information
fmal committed Jan 30, 2022
1 parent 9689fff commit 925b393
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 40 additions & 0 deletions packages/mini-console-logger/README.md
Original file line number Diff line number Diff line change
@@ -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](https://jsbin.com/cawiwep/edit?js,console)
2 changes: 1 addition & 1 deletion packages/mini-console-logger/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mini-console-logger",
"description": "Simple logging utility",
"version": "3.0.0",
"version": "2.1.0",
"license": "",
"repository": {
"type": "git",
Expand Down

0 comments on commit 925b393

Please sign in to comment.