The 📦 lightweight & ⚡ lightning-fast Logger Utility used by Hack4Impact Projects
View the website for API documentation and more!
- 🚀 NO dependencies, <1.1kB size (zipped)
- ✨ TypeScript definitions built in
- 📖 Thorough and detaileddocumentation
- ✅ Tested end-to-end with Jest
- 🌟 Code quality perfected with linters (Prettier, ESLint, EditorConfig, Markdownlint) to reduce bundle size and ensure bug-free code
- 💫 Automated GitHub Workflows ensure that every change is high quality and functional
Using npm:
npm install @hack4impact/loggerUsing yarn:
yarn add @hack4impact/loggerYou can browse the package's files on unpkg.
// ESM: import { join } from "path";const{ join }=require("path");// ESM: import Logger from "@hack4impact/logger";constLogger=require("@hack4impact/logger");constoutputFile=join(__dirname,"logs.json");constlogger=newLogger({logsPath: outputFile});// Log "Hello" an append a created Log object (w/ message, timestamp, index) to the output filelogger.log("Hello");// Log "Hello" and don't append the Log object to the output filelogger.log("Hello",{writeToFile: false});// Log "WARNING!" using console.warn and append to the output filelogger.warn("WARNING!");// ↑ Can also use logger.log("WARNING!", { type: "warn" })// Log "ERROR!" using console.error and append the created Log object (w/ extra as well) to the output filelogger.error("ERROR!",{extra: "Not logged but written to file"});// Log a success message using the static method 'success'Logger.success("It works!");// The list goes on...// Refer to the website for a comprehensive list of all methods with examplesThe website contains all API documentation and information about this package.
If your project uses this package, you can add it to this list by submitting a PR here.
| Owner | Repository Information |
|---|---|
Project Contributors (emoji key):
Yash Totale 💻🤔📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!