plugog
v0.1.3
Published
Module Separated Logger.
Downloads
4
Maintainers
Readme
Module Separated Logger.
👏 Screenshots
Please view test.js.
🌟 Features
Module separated.
Log to the file and the console at the same time. (Or log to one only.)
Printing with chalk.
Log with different timestamp in different destinations.
TypeScript friendly.
💨 Install
Install with yarn:
yarn add plugog
Install with npm:
npm i -S plugog
👉 Usage
Import and create Plugog instance:
const Plugog = require('plugog')
const plugog = new Plugog()
import Plugog from 'plugog'
const plugog = new Plugog()
Optionally, specify a file to log in:
const fs = require('fs')
const stream = fs.createWriteStream('./temp.log')
const plugog = new Plugog(stream)
import * as fs from 'fs'
const stream = fs.createWriteStream('./temp.log')
const plugog = new Plugog(stream)
Add a plugin:
const log = plugog.addPlugin('core')
Plugog is now ready! Use the logging methods below like:
log.i('Info Test.')
INF
log(), inf(), info(), l(), i(), m(), msg(), message(), blue(), b()
Color: Cyan
Console Format: INF|22:18:05|core Info Test.
Log File Format: [2020/2/7 22:18:05][INF][core]Info Test.
ERR
err(), error(), e(), fatal(), stop(), red(), r()
Color: Red
Console Format: ERR|22:18:05|core Error Test.
Log File Format: [2020/2/7 22:18:05][ERR][core]Error Test.
OK
ok(), o(), s(), success(), ready(), green(), g()
Color: Green
Console Format: OK |22:18:05|core Success Test.
Log File Format: [2020/2/7 22:18:05][OK ][core]Success Test.
WRN
warn(), wrn(), w(), warning(), orange(), yellow()
Color: Yellow
Console Format: WRN|14:43:00|core Warn Test.
Log File Format: [2020/2/10 14:43:00][WRN][core]Warn Test.
💬 BUGs & Issues
Feel free to open issues.
💻 Contributions
PRs are welcome! Feel free to contribute on this project.
⚠ LICENSE
MIT