Logging is one of the most underrated yet essential parts of building scalable applications. Whether you're debugging, monitoring, or just tracking events, a good logger can make your life way easier.
That’s where Zylog comes in — a lightweight, flexible, and developer-friendly logger built for Node.js.
✨ Why Zylog?
Most logging libraries are either:
- Too heavy ⚖️
- Too complex 🤯
- Or too limited 🚫
Zylog strikes the perfect balance by being:
- ⚡ Fast and minimal
- 🎨 Beautiful and colorized logs
- 🔧 Highly configurable
- 🧩 Easy to integrate
- 📁 File logging support
📦 Installation
Install Zylog using your favorite package manager:
npm install zylog
or
pnpm add zylog
or
yarn add zylog
🚀 Quick Start
import { zylog } from "zylog";
zylog.info("Server started");
zylog.warn("This is a warning");
zylog.error("Something went wrong");
🧠 Log Levels
Zylog supports multiple log levels out of the box:
| Level | Description |
|---|---|
| info | General information |
| warn | Warnings |
| error | Errors |
| debug | Debugging details |
zylog.debug("Debugging value:", { userId: 123 });
🎨 Colored Output
Zylog automatically colorizes output based on log levels:
zylog.info("Info message"); // Blue/Green
zylog.warn("Warning message"); // Yellow
zylog.error("Error message"); // Red
No extra setup needed 🔥
⚙️ Configuration
You can fully customize Zylog:
import { Zylog } from "zylog";
const logger = new Zylog({
level: "debug",
timestamp: true,
color: true,
});
🧾 Logging to Files
Want to persist logs? Zylog supports file logging too:
const logger = new Zylog({
file: {
path: "./logs/app.log",
},
});
logger.info("This will be saved to file");
📂 Real-World Examples
1. Express Server Logging
import express from "express";
import { zylog } from "zylog";
const app = express();
app.get("/", (req, res) => {
zylog.info("Incoming request", { url: req.url });
res.send("Hello World");
});
app.listen(3000, () => {
zylog.info("Server running on port 3000");
});
2. Error Handling
try {
throw new Error("Database failed");
} catch (err) {
zylog.error("Critical error occurred", err);
}
3. Custom Logger Instance
const logger = new Zylog({
level: "info",
});
logger.info("Custom logger instance");
4. Debugging Complex Objects
const user = {
id: 1,
name: "TenE",
role: "admin",
};
zylog.debug("User details:", user);
🧩 Advanced Usage
Disable Colors (for production logs)
const logger = new Zylog({
color: false,
});
Custom Log Format (conceptual)
const logger = new Zylog({
format: (level, message) => {
return `[${level.toUpperCase()}]: ${message}`;
},
});
⚡ Performance
Zylog is built to be:
- Non-blocking
- Lightweight
- Efficient for high-frequency logging
Perfect for:
- APIs
- CLI tools
- Background jobs
🛠️ Use Cases
- Backend APIs
- CLI tools
- Automation scripts
- Dev debugging
- Production monitoring
🧑💻 Developer Experience
Zylog focuses heavily on DX:
- Clean API
- TypeScript support
- Minimal setup
- Chainable and intuitive usage
🔮 What's Next?
Some ideas you can build with Zylog:
- Log dashboards
- CLI debugging tools
- Middleware logging systems
- Monitoring pipelines
💡 Final Thoughts
If you’re tired of bulky logging libraries or messy console logs, Zylog is a clean and powerful alternative.
It gives you:
- Control
- Simplicity
- Performance
All in one package 🚀
⭐ Support
If you like Zylog: https://github.com/teneplaysofficial/zylog/issues
- ⭐ Star the repo
- 🐛 Report issues
- 💡 Suggest features
📌 TL;DR
import { zylog } from "zylog";
zylog.info("Simple. Clean. Powerful.");
Happy logging! 🎉
Top comments (0)