0.0.4 • Published 4 years ago
@juzousatoru2/easy-logger v0.0.4
Easy tool for better console logs
Disclaimer: Package has not the username since its not possible to rename the npm account.
Highlights
- Icon indicator
- Current time
- Colored status
- Options for customization
- presets for logging infos, warnings, errors and many more
Install
$ npm install @juzousatoru2/easy-logger
Usage
const easylogger = require('@juzousatoru2/easy-logger');
easylogger.info('Server started');
easylogger.warn('Server rate is low');
easylogger.error('Something went wrong');
easylogger.debug('Debug messages');
easylogger.success('Upload succeeded');
Easy-Logger comes with an easy to use options.
const easylogger = require('@juzousatoru2/easy-logger');
// Add chalk for custom colors
const chalk = require('chalk');
// Remove the icons
easylogger.info('no icons', {
icons: false
});
// Remove the time indicator
easylogger.warn('no time', {
time: false,
});
// Remove the status
easylogger.error('no status', {
status: false,
});
// Add a custom date format (works with custom colors too)
easylogger.debug('custom date', {
customTime: Date.now(),
});
// Add a custom status name (works with custom colors too)
easylogger.success('custom status', {
customStatus: chalk.yellow('DEBUG'),
});
Express middleware
Easy-Logger comes with an pre-made express middleware for logging since 0.0.3.
//...
const easylogger = require('@juzousatoru2/easy-logger/middleware');
app.use(easylogger);
// Or add it to specific routes
app.get('/api', easylogger, (req, res) => {
res.status(200);
});