itsbz-logger
v1.0.7
Published
Universal logger
Downloads
4
Readme
ITS.bz :: Logger
Universal logger for NodeJS projects
Installation
yarn add itsbz-logger
or
npm install itsbz-logger
Usage
const
app = require('express')(),
Telegraf = require('telegraf'),
logger = require('itsbz-logger'),
path = require('path'),
app_info = require('./package.json'),
bot = new Telegraf(settings.telegram.token, tg_settings);
logger(app, {
app_name: app_info.name,
app_version: app_info.version,
access_log: path.join(__dirname, 'logs/access.log'),
info_log: path.join(__dirname, 'logs/info.log'),
error_log: path.join(__dirname, 'logs/error.log'),
fatal: path.join(__dirname, 'logs/fatal.log'),
bot: bot,
chat: '-1234567890'
})
console.log('Test LOG')
console.debug('Test DEBUG')
console.warn('Test WARN')
console.error('Test ERROR')
or without Telegram bot:
const
app = require('express')(),
logger = require('itsbz-logger'),
path = require('path'),
app_info = require('./package.json')
logger(app, {
app_name: app_info.name,
app_version: app_info.version,
access_log: path.join(__dirname, 'logs/access.log'),
info_log: path.join(__dirname, 'logs/info.log'),
error_log: path.join(__dirname, 'logs/error.log'),
fatal: path.join(__dirname, 'logs/fatal.log')
})
console.log('Test LOG')
console.debug('Test DEBUG')
console.warn('Test WARN')
console.error('Test ERROR')
Output sample
At the console:
Log files:
Contributing
- Create project directory:
mkdir itsbz-logger && cd itsbz-logger
- Clone repo:
git clone https://gitlab.com/its.bz/npm/logger.git ./
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
History
1.0.7 @ 26 January 2021
- Fixed timezone and locale for timestamps (console and file)
1.0.6 @ 22 November 2020
- Add publish.sh script itsbz-onever package
- Add publish.sh script
- Add publish.sh script
v1.0.5 @ 20 November 2020
- Update changelog
v1.0.4 @ 20 November 2020
- Fix README screenshots
v1.0.3 @ 20 November 2020
- Add screenshots, auto-changelog, fixed log.error output
v1.0.2 @ 19 November 2020
- Add test.js file, run commands for IDE, update README.md
v1.0.1 @ 19 November 2020
- First working package
- Initial commit
- Cleanup package
Credits
Contact us: [email protected]
Our site: its.bz
License
GPL