Skip to content

💢 Make logging friendlier, simpler and use emojis in your messages. Try logger!

License

Notifications You must be signed in to change notification settings

codevor/logger.js

Repository files navigation

logger

License Travis CI Coverage Status Commitizen

💢 Make logging friendlier, simpler and use emojis in your messages. Try logger!

Installation

logger is available on npm/yarn:

$ npm install @codevor/logger.js --save
$ yarn add @codevor/logger.js

Usage

With ES6/import

import Logger from '@codevor/logger.js';

Logger.success('Success message example.');
// => ✅ Success message example
Logger.error('Error message example.');
// => 🚫 Error message example
Logger.warn('Warning message example.');
// => ⚠️ Warning message example
Logger.info('Information message example.');
// => ℹ️ Informational message example

// PROMISE STATUSES LOGS
Logger.pending('Promise message example.', { hello: true });
// => ℹ️ Promise message example | pending {"hello":true}

Logger.fulfilled('Promise message example.', { hello: true });
// => ✅ Promise message example | fulfilled {"hello":true}

Logger.rejected('Promise message example.', { hello: true });
// => 🚫 Promise message example | rejected {"hello":true}

Logger.settled('Promise message example.', { hello: true });
// => ✅ Promise message example | settled {"hello":true}

With require

const Logger = require('@codevor/logger.js');

Logger.success('Success message example.');
// => ✅ Success message example
Logger.error('Error message example.');
// => 🚫 Error message example
Logger.warn('Warning message example.');
// => ⚠️ Warning message example
Logger.info('Information message example.');
// => ℹ️ Informational message example

// PROMISE STATUSES LOGS
Logger.pending('Promise message example.', { hello: true });
// => ℹ️ Promise message example | pending {"hello":true}

Logger.fulfilled('Promise message example.', { hello: true });
// => ✅ Promise message example | fulfilled {"hello":true}

Logger.rejected('Promise message example.', { hello: true });
// => 🚫 Promise message example | rejected {"hello":true}

Logger.settled('Promise message example.', { hello: true });
// => ✅ Promise message example | settled {"hello":true}

Note: All promises convert objects to strings

Change Emojis

Is it possible to change emojis for each message? Yes! Check it out:

import Logger, { Emoji } from '@codevor/logger.js';

Logger.success('Success message example.');
// => ✅ Success message example

Emoji.setEmoji({ type: 'success', emoji: '🐶' });

Logger.success('Success message example.');
// => 🐶 Success message example

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Changelog

This project adheres to Semantic Versioning. Every release, along with the migration instructions, is documented on the Github Releases page.

Bugs and Sugestions

Report bugs or do suggestions using the issues.

License

MIT License © Codevor