# @cuppachino/logger

> Tiny logging utility for tiny projects. Enjoy colored console output without overthinking it.

Latest version **1.1.0** (published 2022-12-19) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install @cuppachino/logger
pnpm add @cuppachino/logger
yarn add @cuppachino/logger
bun add @cuppachino/logger
```

## Health

**Score 30/100 (F)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2022-12-19 |
| First published | 2022-12-15 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 72.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | cuppachino |
| Maintainers | cuppachino |
| Keywords | cuppachino, log, logger, logging, chalk, color, typescript |

## Links

- npm: https://www.npmjs.com/package/@cuppachino/logger
- Repository: https://github.com/Cuppachino/logger
- Homepage: https://github.com/Cuppachino/logger#readme
- Issues: https://github.com/Cuppachino/logger/issues
- npm.io page: https://npm.io/package/@cuppachino/logger

## 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
- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K 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

## Recent versions

- 1.1.0 (latest) — 2022-12-19
- 1.0.3 — 2022-12-16
- 1.0.2 — 2022-12-16
- 1.0.1 — 2022-12-15
- 1.0.0 — 2022-12-15

## README

# @cuppachino/logger

Tiny logging utility for tiny projects. Enjoy colored console output without
overthinking it.

## 📦 Installation

[@cuppachino/logger](https://www.npmjs.com/package/@cuppachino/logger)

```ps
pnpm add @cuppachino/logger
pnpm add -D chalk
```

or

```ps
npm install @cuppachino/logger
npm install --save-dev chalk
```

## 🔍 Example Usage

```ts
import { createLogger } from '@cuppachino/logger'

const logger = createLogger('main' /* Options */)

logger.tag('example', 'blue', 'bold', 'italic').log('hello world')
logger.log('foo').untag()
logger.log('bar')
```

<img src="./example-log.png" alt="Example log output" title="Example Output">

## 🛠️ Configuration

- `colors`: an array of colors/modifiers from `chalk` applied to the logger's
  prefix (default: `'gray'`).
- `tagWrapColors`: an array of colors/modifiers applied to the characters that
  wrap each tag (default: `'dim'`).
- `tagWrapStyle`: the characters used to wrap each tag (default: `'square'`).

```ts
type LoggerOptions = {
	colors: Color[]
	tagWrapColors: Color[]
	tagWrapStyle: WrapStyle
	// "angled" | "square" | "curly" | "parens"
}
```

## 💪 Methods

- `tag`: pushes a tag to the stack
- `untag`: removes the previous tag from the stack.
- `log`: writes a message to the console, prepended by the logger prefix and any
  tags.
- `error`: throws an error

---

## ✏️ Todo

```ts
/*
- transports
- levels-like filtering with tags (ideally avoid upfront logger config)
- maybe more... 
*/
```

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