scriptdash
v1.4.0
Published
Tiny developer-friendly terminal logger: log, array, table, error (TypeScript + chalk)
Downloads
46
Maintainers
Readme
ScriptDash
A Tiny, Developer-Friendly Terminal Logger for Node.js & Deno
ScriptDash is a lightweight, TypeScript-powered logging utility designed for developers who want clear, structured, and visually appealing logs in the terminal. It enhances readability and makes debugging a breeze with color-coded messages, labeled sections, formatted arrays, tables, and error outputs.
⚠️ Under Development
This package is actively being developed. While core logging features are functional, improvements and additional utilities are coming soon.
Features
- TypeScript-first: Full typing for autocompletion and safety.
- Structured Logging: Clear start and end markers, highlighted labels, and color-coded messages.
- Array Support: Pretty print arrays with indexing and color highlights.
- Table Support: Auto-flatten objects and arrays, render readable tables in the console.
- Error Handling: Display errors with optional stack traces.
- Node.js & Deno Compatible: Works seamlessly across multiple runtime environments.
- Customizable Appearance: Colored labels and log sections make outputs easy to distinguish.
Installation
npm install scriptdash
# or
yarn add scriptdashImportant Note
This package is ESM-only (uses ES Modules). Make sure your project is set up to handle ESM packages:
- Your
package.jsonshould have"type": "module" - Use
.mjsextension for your files, or - Use
.jsfiles with"type": "module"in package.json
Basic Usage
Import
// ESM import (recommended)
import { scriptDash } from 'scriptdash';
// CommonJS (if you need it)
const { scriptDash } = await import('scriptdash');Development Setup
If you want to contribute or run the examples locally:
- Clone the repository
git clone https://github.com/majidshakeelshawl/scriptdash.git
cd scriptdash- Install dependencies
npm install- Run the example in watch mode
npm run devimport dashlog from "scriptdash";
// Simple log
dashlog.log({ name: "ScriptDash", description: "A developer-friendly logger" }, "Info");
// Log an array
dashlog.array([1, 2, 3, 4], "Numbers");
// Log a table
dashlog.table(
[
{ id: 1, name: "Alice", role: "Admin" },
{ id: 2, name: "Bob", role: "User" },
],
"Users"
);
// Log an error
dashlog.error(new Error("Something went wrong!"), "Critical", true);Output Examples
Simple Log
╭─ LOG Testing the API response ─╮
│ { │
│ "name": "ScriptDash", │
│ "description": "A simple and pretty logging utility for Node.js" │
│ } │
╰────────────────────────────────────────────────────────╯Table Output
╭─ TABLE Users - [API Response /users/all] ─╮
┌────┬───────┬─────────────┬──────────────┬────────┬────────┐
│ id │ name │ profile.age │ profile.city │ tags.0 │ tags.1 │
├────┼───────┼─────────────┼──────────────┼────────┼────────┤
│ 1 │ Alice │ 30 │ NY │ admin │ team-a │
│ 2 │ Bob │ 25 │ SF │ user │ │
└────┴───────┴─────────────┴──────────────┴────────┴────────┘
╰──────────────────────────────────────────────╯Error Output
╭─ ERROR API Error ─╮
│ Something went wrong!
╰──────────────────────╯Array Output
╭─ ARRAY Array of mixed values ─╮
│ 1.This is a simple string
│ 2.42
│ 3.{"key":"value","nested":{"num":100}}
│ 4.[1,2,3]
│ 5.["This is a simple string",42,{"key":"value","nested":{"num":100}},[1,2,3]]
╰──────────────────────────────────╯Each output type is distinctly formatted with clear borders and labels, making it easy to distinguish different types of logs in your terminal.
API Reference
| Method | Description | Parameters | Returns |
| -------------------------------- | ------------------------------------- | ------------------------------------ | ------- |
| log(data, label?) | Logs any data with optional label | data: unknown, label?: string | void |
| array(items, label?) | Logs arrays in a readable format | items: unknown[], label?: string | void |
| table(data, label?) | Logs object(s) as a console table | data: Record<string, any>[] \| Record<string, any>, label?: string | void |
| error(err, label?, showStack?) | Logs errors with optional stack trace | err: Error \| string, label?: string, showStack?: boolean | void |
Type Definitions
interface ScriptDash {
log(data: unknown, label?: string): void;
array(items: unknown[], label?: string): void;
table(data: Record<string, any>[] | Record<string, any>, label?: string): void;
error(err: Error | string, label?: string, showStack?: boolean): void;
}Why Use ScriptDash?
Logging is often overlooked, but clear logs save hours of debugging and reduce cognitive load. ScriptDash provides visually distinct logs so developers can instantly identify sections, data structures, and errors, improving workflow and debugging efficiency.
- Readable: Colors, labels, and structured output.
- Efficient: Handles arrays and objects automatically.
- Professional: Clean design gives logs a polished, professional feel.
Development Status
Status: Actively under development
Planned Features:
- Customizable themes for logs
- Additional helpers for nested structures
- Improved formatting for deeply nested tables
- Extended support for asynchronous logging and streams
- Hide/Show logs based on NODE_ENV
Contributing
Contributions are welcome! Open an issue or submit a pull request. Ensure you follow the existing formatting and coding conventions to maintain the professional output style.
License
MIT License © Majid Shakeel Shawl
NPM Package: https://www.npmjs.com/package/scriptdash
