# @hackbg/logs

> Define custom console loggers.

Latest version **3.1.1** (published 2025-04-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @hackbg/logs
pnpm add @hackbg/logs
yarn add @hackbg/logs
bun add @hackbg/logs
```

## Health

**Score 50/100 (C)** — status: stable.

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

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 3.1.1 |
| Published | 2025-04-04 |
| First published | 2023-01-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 35.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | imollov, atanas-krondev, mradkov, exactlywhoyouthinkitis |

## Links

- npm: https://www.npmjs.com/package/@hackbg/logs
- Repository: https://github.com/hackbg/toolbox
- Issues: https://github.com/hackbg/toolbox/issues
- npm.io page: https://npm.io/package/@hackbg/logs

## Dependencies (3)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [@hackbg/allo](https://npm.io/package/@hackbg/allo.md) ^1.0.3
- [@hackbg/hide](https://npm.io/package/@hackbg/hide.md) ^1.0.4

## Recent versions

- 3.1.1 (latest) — 2025-04-04
- 3.1.0 — 2025-04-01
- 3.0.0 — 2025-03-31
- 2.3.2 — 2024-03-03
- 2.3.1 — 2024-03-03
- 2.3.0 — 2024-02-12
- 2.2.0 — 2024-01-14
- 2.1.1 — 2023-12-05
- 2.1.0 — 2023-11-17
- 2.0.8 — 2023-11-09
- 2.0.7 — 2023-08-24
- 2.0.6 — 2023-08-24
- 2.0.5 — 2023-08-24
- 2.0.4 — 2023-08-24
- 2.0.3 — 2023-08-24
- … 6 more at https://npm.io/package/@hackbg/logs/versions

## README

# @hackbg/logs

**Logging utilities.**

Exports a `Console` class in ESM and CJS formats.

Usage:

```js
import { Console } from '@hackbg/logs'
// or
const { Console } = require('@hackbg/logs')

const console = new Console("label", {
  color: true, // or false
  json:  true, // or false
  jsonLevelField: 'level', // default: "logMethod"
  jsonMetaField:  'meta',  // default: "logTag"
  jsonDataField:  'data',  // default: "logMessage"
})
console("asdf")
console.log("asdf")
console.warn("asdf")
console.error("asdf")
console.debug("asdf")
console.trace("asdf")
console.table([["asdf","qwer"],["zxcv","uiop"]])
console.table([{asdf:"qwer"},{zxcv:"uiop"}])
console.table({foo:{asdf:"qwer"},bar:{zxcv:"uiop"}})
```

## TODO:

* [ ] Honor `NO_COLOR`

<div align="center">

---

Made with **#%&!** @ [**Hack.bg**](https://foss.hack.bg)

</div>

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