# @ledgerhq/logs

> Ledger logs central point

Latest version **6.19.0** (published 2026-09-01) · Apache-2.0 license · 0 weekly downloads

## Install

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

## Health

**Score 70/100 (B)** — status: active.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 6.19.0 |
| Published | 2026-09-01 |
| First published | 2019-05-19 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 34.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | phenry-ledger, sergii-shkolin, gbrahm-ledger, ldg-github-ci, vbouzon, ledger-releaser |
| Keywords | Ledger |

## Links

- npm: https://www.npmjs.com/package/@ledgerhq/logs
- Repository: https://github.com/LedgerHQ/ts-libs
- Homepage: https://github.com/LedgerHQ/ts-libs/tree/main/libs/logs
- Issues: https://github.com/LedgerHQ/ts-libs/issues
- npm.io page: https://npm.io/package/@ledgerhq/logs

## Recent versions

- 6.19.0 (latest) — 2026-09-01
- 6.17.0-nightly.20260416030536 (nightly) — 2026-04-16
- 6.13.0-next.1 (next) — 2025-06-04
- 6.11.0-tag-word.0 (tag-word) — 2023-10-25
- 6.10.1-monorepo.4 (monorepo) — 2022-03-11
- 6.9.1-taproot.0 (taproot) — 2021-10-14
- 6.2.0-bsc.5 (bsc) — 2021-07-19
- 6.0.0-rc.0 (rc) — 2021-06-18
- 6.0.1-typescript.0 (typescript) — 2021-06-09
- 5.48.1-alpha.25 (canary) — 2021-05-14
- 5.48.1-uglify.0 (uglifyfi) — 2021-04-09
- 6.18.0 — 2026-09-01
- 6.17.0-nightly.20260415165444 — 2026-04-15
- 6.17.0 — 2026-04-15
- 6.17.0-nightly.20260415030445 — 2026-04-15
- … 130 more at https://npm.io/package/@ledgerhq/logs/versions

## README

# @ledgerhq/logs

> [!NOTE]
> **Status: STABLE**

Utility library used by all Ledger libraries to dispatch logs in a unified way.

## Install

```sh
pnpm add @ledgerhq/logs
```

## Usage

```ts
import { log, trace, listen, LocalTracer } from "@ledgerhq/logs";

// Subscribe to all log events
const unsubscribe = listen((log) => {
  console.log(log.type, log.message, log.data);
});

// Emit a log
log("apdu-in", "sending command", { data: "..." });

// Emit a structured trace with context
trace({ type: "hw", message: "opening device", context: { deviceId: "abc" } });

// Use a local tracer to avoid repeating type/context
const tracer = new LocalTracer("hw", { deviceId: "abc" });
tracer.trace("opening device");

unsubscribe();
```

## API

### `log(type, message?, data?)`

Emits a log event.

### `trace({ type, message?, data?, context? })`

Emits a structured trace with optional context.

### `listen(subscriber): Unsubscribe`

Subscribes to log events. Returns an unsubscribe function.

### `LocalTracer`

A class that holds a fixed `type` and `context`, making it convenient to emit multiple traces in one scope without repeating them.

## License

Apache-2.0

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