mirror of
https://github.com/Wessel/pikmin.git
synced 2026-06-08 14:18:54 +02:00
57 lines
1.9 KiB
Markdown
57 lines
1.9 KiB
Markdown
<img src="wessel.meek.moe/pikmin/thumb.png" align="left" width="180px" height="180px"/>
|
|
<img align="left" width="0" height="192px" hspace="10"/>
|
|
|
|
> <a href="https://github.com/PassTheWessel/pikmin">Pikmin</a> - A lightweight, customizable Node.JS logger
|
|
|
|
[](/LICENSE) [](https://travis-ci.com/PassTheWessel/pikmin) [](https://npmjs.com/package/pikmin)
|
|
|
|
|
|
Pikmin is a fast and highly customizable logger for Node.JS with various custom transports
|
|
|
|
[`GitHub`](https://github.com/PassTheWessel/pikmin) **|** [`NPM`](https://npmjs.com/package/pikmin)
|
|
|
|
<br>
|
|
|
|
## Installing
|
|
```sh
|
|
$ yarn add pikmin # Install w/ Yarn
|
|
$ npm i pikmin # Install w/ NPM
|
|
```
|
|
|
|
## Example
|
|
```js
|
|
// main.js
|
|
const Pikmin = require('pikmin');
|
|
const pikmin = new Pikmin.instance({
|
|
name: 'main',
|
|
autogen: true,
|
|
format: `${Pikmin.colors.cyan('[%h:%m:%s]')} %l ${Pikmin.colors.green('->')} `,
|
|
transports: [
|
|
new Pikmin.FileTransport({ file: 'tmp/log.txt' }),
|
|
new Pikmin.ConsoleTransport({ process: process, name: 'info' })
|
|
]
|
|
});
|
|
|
|
pikmin.addTransport(new Pikmin.ConsoleTransport({ process: process, name: 'error', format: `${Pikmin.colors.red('%l')}`, defaults: {} }));
|
|
Pikmin.bind(pikmin, console);
|
|
|
|
pikmin.info(Symbol.iterator);
|
|
pikmin.info({ 'test': 123 });
|
|
pikmin.error('This is an error!');
|
|
|
|
require('./global.js')();
|
|
Pikmin.unbind(pikmin);
|
|
|
|
// global.js
|
|
const { loggers, colors } = require('../');
|
|
const log = loggers.get('main');
|
|
|
|
module.exports = () => {
|
|
log.info(`Method "${colors.green('info')}" is global`);
|
|
console.pikmin.error('Oh no!');
|
|
};
|
|
```
|
|
|
|
## Documentation
|
|
Documentation can be found at [https://github.com/PassTheWessel/pikmin/wiki](https://github.com/PassTheWessel/pikmin/wiki)
|