Table of Contents
As an attempt to publish my first NPM package, I create this logger utility to basically prefix your logs with a sassy remark. Happy coding!
This package is hosted on NPM and therefore can be installed with:
- npm
npm install sassy-logger
Log with specific methods:
import SassyLogger from 'sassy-logger';
SassyLogger.debug("Initializing API client with parameters...");
// Output: [🔍 Just a little check-in] Initializing API client with parameters...
SassyLogger.info("Server is running on port %d.", port);
// Output: [💤 It’s cute that you think this matters.] Server is running on port 3000
SassyLogger.warn("API rate limit almost exceeded.");
// Output: [🤡 Plot twist...] API rate limit almost exceeded.
SassyLogger.error("Unexpected shutdown.");
// Output: [🔥 Absolute disaster incoming] Unexpected shutdown.
SassyLogger.fatal("System crash! Shutting down.");
// Output: [💀 Hope you updated your will] System crash! Shutting down.
SassyLogger.oops("Missed a semicolon, causing the syntax error.");
// Output: [😬 That’s on you...] Missed a semicolon, causing the syntax error.
SassyLogger.blessed("Successfully deployed the latest version!");
// Output: [✨ The universe has smiled upon us] Successfully deployed the latest version!Generic log method:
import SassyLogger from 'sassy-logger';
// default
SassyLogger.log("Returned value is 36.");
// Output: [🤷 Whatever] Initializing API client with parameters...
// with level
SassyLogger.log("Returned value is 36.", "debug");
// Output: [🔍 Just a little check-in] Initializing API client with parameters...Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt for more information.
Nghi Hua - https://nghihua.io.vn/