# clrsole

> Colorful `console.log` for structured logging.

Latest version **6.0.0** (published 2025-05-11) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.0.0 |
| Published | 2025-05-11 |
| First published | 2019-03-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jesse Feng |
| Maintainers | fengxinming |
| Keywords | console, log, color |

## Links

- npm: https://www.npmjs.com/package/clrsole
- Repository: https://github.com/fengxinming/node-collection
- Homepage: https://fengxinming.github.io/node-collection/modules/clrsole/
- Issues: https://github.com/fengxinming/node-collection/issues
- npm.io page: https://npm.io/package/clrsole

## Dependencies (3)

- [picocolors](https://npm.io/package/picocolors.md) ^1.1.1
- [base-log-factory](https://npm.io/package/base-log-factory.md) ^3.0.0
- [blf-debug-appender](https://npm.io/package/blf-debug-appender.md) ^2.0.0

## 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

- 6.0.0 (latest) — 2025-05-11
- 3.0.0 (beta) — 2020-03-21
- 5.0.4 — 2025-03-27
- 5.0.3 — 2025-03-25
- 5.0.1 — 2025-03-22
- 5.0.0 — 2025-03-22
- 4.0.0 — 2024-04-24
- 3.0.1 — 2020-04-12
- 3.0.0-beta.0 — 2020-03-21
- 2.0.0 — 2019-11-06
- 1.1.1 — 2019-08-19
- 1.1.0 — 2019-05-09
- 1.0.2 — 2019-05-09
- 1.0.1 — 2019-04-30
- 1.0.0 — 2019-04-19
- … 2 more at https://npm.io/package/clrsole/versions

## README

# clrsole 

[![npm package](https://nodei.co/npm/clrsole.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/clrsole)

[![NPM version](https://img.shields.io/npm/v/clrsole.svg?style=flat)](https://npmjs.org/package/clrsole) 
[![NPM Downloads](https://img.shields.io/npm/dm/clrsole.svg?style=flat)](https://npmjs.org/package/clrsole)

> **Colorful console.log for structured logging**  
> A logging utility with log levels and color highlighting inspired by log4j

---

## Features
- 🎨 **Colorized output**: Green/Red/Yellow/Blue for different message types
- 📝 **6-level logging**: trace/debug/info/warn/error/fatal
- 🛠 **Flexible formatting**: Customize log message templates
- 🌐 **TypeScript support**: Full type definitions included

---

## Installation
```bash
npm install clrsole
```

---

## Getting Started

### Basic Usage
```javascript
import { factory, clrsole } from 'clrsole';

// Create named logger
const appLogger = factory.getLogger('app');

// Structured logging with level indicators
appLogger.info('User login success:', { userId: 123, timestamp: new Date() });
appLogger.error('Request failed:', { statusCode: 500 });

// Direct color output
clrsole.green('Success message');
clrsole.red('Error occurred', new Error('Detailed error'));
```

### Output Example
```text
\x1b[32m[2023-08-01 10:00:00.620+08:00] [INFO] [app] - User login success: { userId: 123, ... }\x1b[0m
\x1b[31m[2023-08-01 10:01:00.620+08:00] [ERROR] [app] - Request failed: { statusCode: 500 }\x1b[0m
```

---

## Advanced Features

### Level Control
```javascript
// Only log warnings and above
appLogger.level = 'WARN';
```

---

## Contributing

We welcome contributions from the community! If you find a bug or want to suggest an improvement, feel free to open an issue or submit a pull request.

### How to Contribute
1. Fork the repository.
2. Create a new branch for your changes.
3. Submit a pull request with a clear description of your changes.

## License

This project is licensed under the [MIT License](LICENSE).

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