1.0.3 β’ Published 8 months ago
@devsahu/loggify v1.0.3
Loggify π
A tiny, colorful, emoji-enhanced logger for Node.js projects β powered by chalk. Perfect for CLI tools, debug logs, or just having some fun in your terminal.
β¨ Features
- Easy-to-use logger with semantic types (
success,error,warn,info,debug, etc.) - Timestamps included (optional)
- Emojis and colored labels for better visibility
- Minimal and fast β zero runtime dependencies (besides
chalk)
π¦ Installation
npm install loggifyOr using yarn:
yarn add loggifyπ Usage
import { loggify } from 'loggify';
loggify('success', 'Operation completed successfully!');
loggify('error', 'Something went wrong!');
loggify('info', 'Here is some information.');
loggify('warn', 'This is a warning.');
loggify('debug', 'Debugging details...');
loggify('rocket', 'Launching...');
loggify('heart', 'We love open source!');βοΈ Options
The loggify function accepts an optional third argument for options:
loggify(type, message, { timestamp: true });Available Types
| Type | Emoji | Color |
|---|---|---|
| success | β | Green Bold |
| error | β | Red Bold |
| warn | β οΈ | Orange Bold |
| info | βΉοΈ | Blue |
| debug | π | Gray |
| rocket | π | Cyan Bold |
| heart | β€οΈ | Magenta Bold |
π§ͺ Example Output
[12:34:56 PM] β
SUCCESS: Operation completed!
[12:34:56 PM] β ERROR: Something went wrong!
[12:34:56 PM] π ROCKET: Launching...β οΈ Common Issues & Fixes
1. β Cannot use ES modules (import/export)
If you get errors like:
SyntaxError: Cannot use import statement outside a moduleFix:
- In your
package.json, add:
"type": "module"Or switch to CommonJS syntax:
const chalk = require('chalk');
// ...
module.exports = { loggify };2. β chalk.keyword is not a function
This only works in chalk v4+ with full color support.
β Make sure you're using a compatible version:
npm install chalk@5But note: chalk@5** is pure ESM**, so you must use "type": "module" in package.json.
3. β Doesnβt log anything
- Ensure youβre calling the function in a test file or at the bottom of your script.
- Example:
loggify("rocket", "Launching the app!");π License
MIT Β© 2025 [Your Name or GitHub Handle]