logmojify v1.0.10
π LogMojiFy - The Smart Emoji Logger π₯
π― Why LogMojiFy?
LogMojiFy is a lightweight yet powerful logging utility that automatically enhances console logs by overriding:
β
console.log
β
console.warn
β
console.error
β
console.debug
πΉ It assigns emoji-based categories for improved visibility and debugging.
πΉ It automatically detects log purposes (errors, security, transactions, API calls, etc.) and assigns relevant emojis for instant log identification.
π No need to change your existing console.log
statementsβLogMojiFy does all the work for you!
π How to Use LogMojiFy in Your Project
1οΈβ£ Global Import (Use LogMojiFy Throughout Your Project)
To enable logmojify
globally (so it modifies console.log
everywhere), import it in your main entry file.
Project Type | Where to Import |
---|---|
Node.js (Backend) | index.ts or server.ts |
React (Vite / CRA) | src/main.tsx or src/index.tsx |
Next.js | app/layout.tsx or pages/_app.tsx |
Vue.js | main.js or main.ts |
Global Config Approach | src/config.ts , then import in index.ts |
β Example:
// src/main.tsx (React) or index.ts (Node.js)
import "logmojify"; // Enables automatic log enhancements globally
π After this, all console.log
statements will be enhanced everywhere.
2οΈβ£ Import in a Specific File (Scoped Usage)
If you only need logmojify
in certain files instead of globally, you can import and use it like this:
import logger from "logmojify";
logger.setCustomEmojis({ error: "π₯", warn: "β οΈ" });
console.log("This is an info message"); // Enhanced with emojis
console.error("Something went wrong!"); // π₯ Something went wrong!
Note: If
logmojify
is imported globally (import "logmojify";
), you don't need this manual import.
π€ Automatic Log Categorization
LogMojiFy automatically detects the log type based on keywords in your logs.
Example Log Message | Categorized As | Emoji |
---|---|---|
"Database connection established!" | Database | πΎ |
"Slow response detected" | Performance | β‘ |
"Unauthorized access attempt" | Security | π |
"Fetching API data" | Network | π |
"User clicked the checkout button" | User Action | π±οΈ |
"Payment of $49.99 completed successfully" | Transaction | π° |
β No manual categorization neededβLogMojiFy detects them for you!
π¨ Customizing Emojis
You can override default emojis using setCustomEmojis()
:
logger.setCustomEmojis({
error: "π₯",
warn: "β οΈ",
debug: "π",
success: "π",
});
Now, logs will use your custom emojis instead of the defaults.
π Default Log Categories & Emojis
Log Type | Emoji | Description |
---|---|---|
info | π | General information logs (Now orange background) |
warn | β οΈ | Warnings that require attention |
error | β | Errors & failures |
debug | π οΈ | Debugging information |
success | β | Success messages |
network | π | Network-related logs (API calls, requests) |
db | πΎ | Database operations |
critical | π₯ | Critical issues requiring urgent action |
security | π | Security-related events |
performance | β‘ | Performance optimizations & latency issues |
analytics | π | Tracking, metrics, and analytics events |
event | π | Event-driven logs (tasks, jobs) |
user-action | π±οΈ | User interactions & UI events |
system | π₯οΈ | System & process logs |
audit | π | Compliance and audit logs |
config | π§ | Configuration changes |
testing | π | Logs related to testing & debugging |
ai | π§ | AI/ML-related logs |
transaction | π° | Payment & transaction logs |
file | π | File operations (upload/download) |
π How is LogMojiFy Different from Other Loggers?
Unlike Winston, Pino, or default console.log
, LogMojiFy automatically categorizes logs and enhances console methods without extra setup.
Feature | LogMojiFy | Other Loggers (e.g., Winston, Pino) |
---|---|---|
Automatic Console Override | β Yes | β No (Requires explicit calls) |
Automatic Log Categorization | β Yes | β No |
Emoji-Based Logging | β Yes | β No |
Color-Coded Output | β Yes | β Yes |
Customizable Emojis | β Yes | β No |
Works in Browser & Node.js | β Yes | β Most are Node-only |
π No need to refactor your codeβLogMojiFy makes logs instantly better!
π How to Disable the Console Override
If you ever need to disable LogMojiFy and restore the default console methods:
console.log = console.constructor.prototype.log;
console.warn = console.constructor.prototype.warn;
console.error = console.constructor.prototype.error;
console.debug = console.constructor.prototype.debug;
ποΈ Contributing
Contributions are welcome! Follow these steps:
1οΈβ£ Fork the repository
2οΈβ£ Create a feature branch (feature/new-feature
)
3οΈβ£ Commit your changes
4οΈβ£ Push to GitHub & create a PR
π License
MIT License Β© 2025 sandunlasantha
πΉ Stay Updated!
π¦ View on npm
π Star on GitHub