# @arcjet/logger

> Arcjet lightweight logger which mirrors the Pino structured logger interface

Latest version **1.14.1** (published 2026-10-07) · Apache-2.0 license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.14.1 |
| Published | 2026-10-07 |
| First published | 2023-12-07 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.21.0 <23 \|\| >=24.5.0 |
| Dependencies | 1 |
| Unpacked size | 22 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 685 |
| Author | Arcjet |
| Maintainers | quinn-arcjet, davidmytton |
| Keywords | arcjet, debug, log, util, utility |

## Links

- npm: https://www.npmjs.com/package/@arcjet/logger
- Repository: https://github.com/arcjet/arcjet-js
- Homepage: https://arcjet.com
- Issues: https://github.com/arcjet/arcjet-js/issues
- npm.io page: https://npm.io/package/@arcjet/logger

## Dependencies (1)

- [@arcjet/sprintf](https://npm.io/package/@arcjet/sprintf.md) 1.14.1

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

- 1.14.1 (latest) — 2026-10-07
- 1.10.0-rc.1 (rc) — 2026-08-07
- 1.14.0 — 2026-10-01
- 1.13.0 — 2026-09-16
- 1.12.0 — 2026-09-08
- 1.11.0 — 2026-08-26
- 1.10.0 — 2026-08-11
- 1.10.0-rc.0 — 2026-08-04
- 1.9.1 — 2026-07-15
- 1.9.0 — 2026-07-15
- 1.8.0 — 2026-07-07
- 1.8.0-rc.0 — 2026-07-07
- 1.7.0 — 2026-07-06
- 1.7.0-rc.1 — 2026-07-06
- 1.7.0-rc.0 — 2026-07-03
- … 63 more at https://npm.io/package/@arcjet/logger/versions

## README

<!-- trunk-ignore-all(markdownlint/MD024) -->
<!-- trunk-ignore-all(markdownlint/MD001) -->

<a href="https://arcjet.com" target="_arcjet-home">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://arcjet.com/logo/arcjet-dark-lockup-voyage-horizontal.svg">
    <img src="https://arcjet.com/logo/arcjet-light-lockup-voyage-horizontal.svg" alt="Arcjet Logo" height="128" width="auto">
  </picture>
</a>

# `@arcjet/logger`

<p>
  <a href="https://www.npmjs.com/package/@arcjet/logger">
    <picture>
      <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/v/%40arcjet%2Flogger?style=flat-square&label=%E2%9C%A6Aj&labelColor=000000&color=5C5866">
      <img alt="npm badge" src="https://img.shields.io/npm/v/%40arcjet%2Flogger?style=flat-square&label=%E2%9C%A6Aj&labelColor=ECE6F0&color=ECE6F0">
    </picture>
  </a>
</p>

[Arcjet][arcjet] lightweight logger which mirrors the [Pino][pino-api]
structured logger interface.

- [npm package (`@arcjet/logger`)](https://www.npmjs.com/package/@arcjet/logger)
- [GitHub source code (`logger/` in `arcjet/arcjet-js`)](https://github.com/arcjet/arcjet-js/tree/main/logger)

## What is this?

This is an internal utility to help us log things.
It provides a small interface, a bit like [Pino][github-pino],
so that users with custom needs can swap it for their own logger.

## When should I use this?

You should probably not use this but use one of the alternatives instead.
This package matches our current needs which are likely different from yours.

## Install

This package is ESM only.
Install with npm in Node.js:

```sh
npm install @arcjet/logger
```

## Use

```ts
import { Logger } from "@arcjet/logger";

const logger = new Logger({ level: "debug" });

logger.debug("only printed in debug mode");
// Logs ✦Aj DEBUG only printed in debug mode

logger.error("%d + %d = %d", 1, 2, 3);
// Logs ✦Aj ERROR 1 + 2 = 3
```

## API

This package exports the identifier
[`Logger`][api-logger].
There is no default export.

This package exports the [TypeScript][] types
[`LogLevel`][api-log-level] and
[`Options`][api-options].

### `LogLevel`

This type represents the supported log levels. The order from most verbose
to least verbose is `debug`, `info`, `warn`, to `error`. For example, when
you set the level to `info`, then `warn` and `error` messages are also
logged.

###### Type

```ts
type LogLevel = "debug" | "error" | "info" | "warn";
```

### `Options`

You can pass these options when creating a new logger.

###### Fields

- `level` ([`LogLevel`][api-log-level])
  — the log level to use

### `new Logger(options)`

Creates a new logger instance.

###### Parameters

- `options` ([`Options`][api-options])
  — configuration for the logger

###### Returns

A `Logger` instance.

#### `Logger#[debug | error | info | warn]([mergingObject, ][message, ]…interpolationValues)`

Depending on the configured log level, these methods either do nothing or
print a log message. The message template and interpolation values are passed
through [`sprintf`][arcjet-sprintf].

###### Parameters

- `mergingObject` (`Record<string, unknown>`, optional)
  — an object to merge into the log output
- `message` (`string`)
  — the message template
- `interpolationValues` (`Array<unknown>`)
  — values to interpolate into the template

###### Returns

Nothing (`undefined`).

## License

[Apache License, Version 2.0][apache-license] © [Arcjet Labs, Inc.][arcjet]

[api-logger]: #new-loggeroptions
[api-log-level]: #loglevel
[api-options]: #options
[arcjet-sprintf]: ../sprintf/
[arcjet]: https://arcjet.com
[github-pino]: https://github.com/pinojs/pino
[pino-api]: https://github.com/pinojs/pino/blob/8db130eba0439e61c802448d31eb1998cebfbc98/docs/api.md#logger
[apache-license]: http://www.apache.org/licenses/LICENSE-2.0
[typescript]: https://www.typescriptlang.org/

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