@abhixdevs/inklog
v1.0.0
Published
A beautiful, lightweight logger for Node.js CLI applications.
Readme
InkLog
🚀 A beautiful, lightweight logger for Node.js CLI applications.
Transform plain console.log() statements into clean, colorful, and structured terminal logs.
Perfect for CLI tools, automation scripts, code generators, scaffolding tools, and internal developer platforms.
✨ Features
- 🎨 Beautiful colored log levels
- ✔ Built-in icons
- 📏 Automatic text wrapping
- 📐 Automatically adapts to terminal width
- ⚙️ Configurable (colors & icons)
- ⚡ Lightweight
- 📦 Zero dependencies (except Chalk)
- 🟦 Fully written in TypeScript
Installation
npm install @abhixdevs/inklogor
yarn add @abhixdevs/inklogor
pnpm add @abhixdevs/inklogQuick Start
import {
successLog,
errorLog,
warningLog,
infoLog
} from "@abhixdevs/inklog";
successLog("Service created successfully.");
warningLog("Docker is not installed.");
errorLog("Unable to connect to MongoDB.");
infoLog("Starting authentication service...");Output
───────────────────────────────────────────────────────────────────────────────
✔ SUCCESS ─ Service created successfully.
───────────────────────────────────────────────────────────────────────────────
✖ ERROR ─ Unable to connect to MongoDB.
───────────────────────────────────────────────────────────────────────────────
⚠ WARNING ─ Docker is not installed.
───────────────────────────────────────────────────────────────────────────────
ℹ INFO ─ Starting authentication service...
───────────────────────────────────────────────────────────────────────────────Long messages are automatically wrapped.
───────────────────────────────────────────────────────────────────────────────
✔ SUCCESS ─ Authentication service has been created successfully with routes,
interfaces, models, controllers and Docker configuration.
───────────────────────────────────────────────────────────────────────────────API
successLog()
Displays a success message.
successLog();Default message
Operation completed successfullyerrorLog()
Displays an error message.
errorLog();Default message
An unexpected error occurredwarningLog()
Displays a warning message.
warningLog();Default message
Potential issue identifiedinfoLog()
Displays an informational message.
infoLog();Default message
Just a heads upConfiguration
InkLog allows you to configure colors and icons.
Disable Colors
import { disableColors } from "@abhixdevs/inklog";
disableColors();Enable Colors
import { enableColors } from "@abhixdevs/inklog";
enableColors();Disable Icons
import { disableIcons } from "@abhixdevs/inklog";
disableIcons();Enable Icons
import { enableIcons } from "@abhixdevs/inklog";
enableIcons();Configure Everything
import { setLoggerConfig } from "@abhixdevs/inklog";
setLoggerConfig({
colors: false,
icons: true
});Example
import {
successLog,
warningLog,
errorLog,
infoLog,
disableColors
} from "@abhixdevs/inklog";
disableColors();
infoLog("Creating service...");
successLog("Users service created.");
warningLog("Redis is unavailable. Continuing without cache.");
errorLog("Failed to connect to PostgreSQL.");Why InkLog?
Instead of...
Connected
Loading...
Error
DoneGet...
───────────────────────────────────────────────────────────────────────────────
✔ SUCCESS ─ Connected successfully.
───────────────────────────────────────────────────────────────────────────────
ℹ INFO ─ Loading configuration...
───────────────────────────────────────────────────────────────────────────────
⚠ WARNING ─ Redis cache unavailable.
───────────────────────────────────────────────────────────────────────────────
✖ ERROR ─ Failed to connect to database.
───────────────────────────────────────────────────────────────────────────────InkLog makes CLI output easier to read, easier to debug, and much more professional.
Use Cases
- CLI Applications
- Internal Developer Tools
- Project Scaffolding
- Automation Scripts
- Build Pipelines
- DevOps Utilities
- Code Generators
- Node.js Scripts
License
MIT
Author
Built with ❤️ by Abhishek Sankhwar
If you like this project, consider giving it a ⭐ on GitHub.
