# osolog

> It's just a console log extension

Latest version **1.1.0** (published 2026-05-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install osolog
pnpm add osolog
yarn add osolog
bun add osolog
```

Provides the command `osolog`.

## Health

**Score 55/100 (C)** — status: active.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2026-05-16 |
| First published | 2022-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 28.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Guillermo Salazar |
| Maintainers | osito82 |
| Keywords | logger, log, console |

## Links

- npm: https://www.npmjs.com/package/osolog
- Repository: https://github.com/osito82/osolog
- Homepage: https://github.com/osito82/osolog#readme
- Issues: https://github.com/osito82/osolog/issues
- npm.io page: https://npm.io/package/osolog

## Dependencies (3)

- [colors](https://npm.io/package/colors.md) ^1.4.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [cli-table3](https://npm.io/package/cli-table3.md) ^0.6.3

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2026-05-16
- 1.0.6 — 2023-05-06
- 1.0.5 — 2022-07-11
- 1.0.4 — 2022-07-07
- 1.0.3 — 2022-07-05
- 1.0.2 — 2022-07-05
- 1.0.1 — 2022-07-05

## README

# OsoLog 🐻

[![NPM Version](https://img.shields.io/npm/v/osolog.svg)](https://www.npmjs.com/package/osolog)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

**OsoLog** is a lightweight, powerful extension for the JavaScript `console.log`. It transforms messy terminal outputs into structured, readable, and beautiful logs with zero effort.

Perfect for debugging complex objects, generating terminal tables, or preparing logs for external monitors like Splunk.

---

## 🚀 Key Features

- **Structured Templates:** Format objects into clean, scannable strings (Brackets & Keys).
- **Auto-Tables:** Render arrays and multidimensional data as beautiful CLI tables.
- **Rich Coloring:** Full integration with the `colors` library for vibrant terminal output.
- **Transformation Pipes:** Pass data through custom functions before logging.
- **TypeScript Support:** Full type definitions included for a superior DX.
- **NPM Safe:** Fully backwards compatible with older versions.

---

## 📦 Installation

```bash
npm install osolog
```

---

## 🛠 Quick Start

```js
const OsoLog = require("osolog");
const log = new OsoLog();

// Log anything - Strings, Objects, Arrays, or Mixed!
log.R("Hello World", { status: "Active" }, [1, 2, 3]);
```

---

## 💡 Advanced Usage

### 1. Object Templates (Brackets & Keys)
Templates are perfect for making objects readable at a glance or for structured logging systems.

```js
const user = { id: 1, name: "Mario", role: "Admin" };

// Brackets Template: Clean and scannable
log.Template({ name: "brackets", title: "USER_AUTH", date: true }).R(user);
// Output: [USER_AUTH][2026-05-16T...][id:1][name:"Mario"][role:"Admin"]

// Keys Template: Valid JSON-like format
log.Template({ name: "keys", title: "API_RES", date: true }).R(user);
// Output: {"title":"API_RES","Date":"...","id":1,"name":"Mario","role":"Admin"}
```

### 2. Beautiful Tables
Easily visualize arrays and multidimensional data.

```js
const data = [
  [1, "Node.js", "Stable"],
  [2, "React", "Stable"]
];

// Multidimensional table with custom headers
log.Args({ head: ["ID", "Tech", "Status"] }).R(data);
```

### 3. Custom Coloring
Apply vibrant styles to your logs using the built-in color engine.

```js
log.Args({ 
  colors: { key: ["green", "bold"], value: ["yellow"] },
  template: { name: "brackets", title: "DEBUG" } 
}).R({ database: "Connected", latency: "14ms" });

// Or apply a quick rainbow effect to a string
log.Args({ colors: ["rainbow", "bold"] }).R("Everything is awesome!");
```

### 4. Transformation Functions (`.Funcs`)
Process your data on the fly before it hits the console.

```js
const sum = (arr) => arr.reduce((a, b) => a + b, 0);

log.Funcs(sum).R([10, 20, 30]); // Output: 60
```

---

## ⚙️ Configuration

You can initialize `OsoLog` with a global configuration object:

| Attribute | Default | Description |
| :--- | :--- | :--- |
| `logger` | `true` | Enable or disable all console output. |
| `enableColors` | `false` | Global toggle for terminal colors. |
| `string_caps` | `false` | Automatically convert all logged strings to UPPERCASE. |
| `array` | `"default"` | Set to `"default_table"` for automatic console.table. |
| `multiarray` | `"default"` | Set to `"custom_table"` for advanced CLI tables. |

---

## ⌨️ TypeScript Support

OsoLog comes with built-in type definitions. Enjoy full autocompletion in VS Code:

```typescript
import OsoLog, { ConfigObject } from 'osolog';

const config: ConfigObject = { enableColors: true };
const log = new OsoLog(config);
```

---

## 🔄 Backwards Compatibility

We care about your existing code. Version 1.1.0+ remains fully compatible with:
- The legacy `new osolog.R()` constructor pattern.
- Older configuration typos (e.g., `multiarray: "defualt_table"`).
- Older template names (e.g., `name: "brakets"`).

---

## 📜 License

MIT © [Guillermo Salazar](https://github.com/osito82)

---
_Source: https://npm.io/package/osolog · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
