UNPKG

log101

Version:

Color the console with simple light weight npm package

71 lines (49 loc) â€ĸ 2.36 kB
# 📝 Console Logger Utility A đŸ› ī¸ simple and 🎨 customizable logging utility for styled đŸ–Ĩī¸ console messages. This utility provides predefined styles for different log 📊 levels (e.g., `â„šī¸ info`, `âš ī¸ warning`, `🚨 danger`, `❌ error`, `✅ success`) and allows full đŸ› ī¸ customization for additional ⚡ flexibility. ## đŸ“Ĩ Installation Install the đŸ“Ļ package via npm: ```bash npm install log101 ``` ## đŸ–ąī¸ Usage Import the package into your đŸ–Ĩī¸ project: ```javascript import log from "log101"; ``` ### 🔍 Logging with Predefined Styles ```javascript // ✅ Default style (đŸŸĸ green, đŸŸĸ bold, 📏 large text) log("This is a default message"); // 🎨 Predefined styles for log 📊 levels log("â„šī¸ Information message", "info"); // đŸ”ĩ Blue text for â„šī¸ informational logs log("âš ī¸ Warning message", "warning"); // 🟠 Orange text for âš ī¸ warnings log("🚨 Critical issue detected!", "danger"); // 🔴 Red text for 🚨 critical issues log("❌ An error occurred!", "error"); // 🛑 Dark 🔴 red text for ❌ errors log("✅ Operation was successful!", "success"); // đŸŸĸ Green text for ✅ success ``` ### đŸ› ī¸ Logging with Custom Styles You can pass a 🎨 custom style object to override the predefined styles: ```javascript log("đŸ–Œī¸ Custom styled message", { color: "#FF5733", fontSize: "18px", fontWeight: "normal", fontStyle: "italic" }); ``` ### 🎨 Predefined Styles | Style | 📝 Description | |------------|--------------------------------------------------| | `default` | đŸŸĸ Green, đŸŸĸ bold, 📏 xx-large text | | `info` | đŸ”ĩ Blue, đŸ”ĩ bold, 📏 large text | | `warning` | 🟠 Orange, 🟠 bold, 📏 large text | | `danger` | 🔴 Red, 🔴 bold, 📏 large text | | `error` | 🛑 Dark 🔴 red, 🛑 bold, 📏 large text | | `success` | đŸŸĸ Green, đŸŸĸ bold, 📏 large text | ### 🎨 Dynamic CSS String You can also pass a âœī¸ raw CSS string if you prefer: ```javascript log("🔮 Direct CSS example", "color:purple;font-size:24px;font-weight:bold;text-decoration:underline"); ``` ## 📜 License This project is licensed under the âš–ī¸ MIT License.