# @tsmodule/log

> Type-safe wrapper around `ansi-styles`, similar to `chalk`. Weighs 4kB.

Latest version **3.0.6** (published 2023-05-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tsmodule/log
pnpm add @tsmodule/log
yarn add @tsmodule/log
bun add @tsmodule/log
```

## 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 | 3.0.6 |
| Published | 2023-05-27 |
| First published | 2022-11-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=14 |
| Dependencies | 0 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ctjlewis |

## Links

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

## Recent versions

- 3.0.6 (latest) — 2023-05-27
- 3.0.5 — 2023-05-27
- 3.0.4 — 2023-05-27
- 3.0.3 — 2023-05-27
- 3.0.2 — 2023-05-27
- 3.0.1 — 2023-05-27
- 3.0.0 — 2023-05-27
- 2.2.1 — 2022-12-04
- 2.2.0 — 2022-12-03
- 2.1.5 — 2022-11-28
- 2.1.4 — 2022-11-27
- 2.1.3 — 2022-11-27
- 2.1.2 — 2022-11-27
- 2.1.1 — 2022-11-27
- 2.1.0 — 2022-11-26
- … 55 more at https://npm.io/package/@tsmodule/log/versions

## README

# Console styles

Type-safe wrapper around `ansi-styles`, similar to `chalk`. Weighs 4kB.

### Example

You can provide a single style as a string, or multiple as an array of strings
to avoid callback hell common with chalk.

```ts
import { style } from "@tsmodule/log";

console.log(style("Hello world!", ["green", "bold"]))
```

Also includes `log()` and `error()` proxies for `console.log` and
`console.error`, which add sensible spacing by default (can override via last
`paddingOptions` arg) and allow for easier styling:

```ts
import { group, log } from "@tsmodule/log";

log("Styles testing! ", ["white", "bold"]);
log("Running tests...", ["bold", "underline", "grey"]);
log("✓ 10 tests passed", ["green"]);

group.start("Group 1");
log("Group 1 log 1", ["blue"]);
log("Group 1 log 2", ["blue"]);
group.end();

group.start("Group 2", ["red"]);
log("Group 2 log 1", ["italic"]);
log("Group 2 log 2", ["italic"]);
group.end();
```

![](https://github.com/tsmodule/log/blob/master/example.png?raw=true)

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