# @percy/logger

> Common logger used throughout the Percy CLI and SDKs.

Latest version **1.32.11** (published 2026-09-24) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.32.11 |
| Published | 2026-09-24 |
| First published | 2020-07-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 86 |
| Maintainers | percy-admin |

## Links

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

## Recent versions

- 1.32.11 (latest) — 2026-09-24
- 1.32.12-beta.4 (beta) — 2026-10-21
- 1.31.15-alpha.0 (alpha) — 2026-05-21
- 1.32.12-beta.3 — 2026-10-16
- 1.32.12-beta.2 — 2026-10-09
- 1.32.12-beta.1 — 2026-10-06
- 1.32.12-beta.0 — 2026-10-01
- 1.32.11-beta.2 — 2026-09-22
- 1.32.11-beta.1 — 2026-09-22
- 1.32.11-beta.0 — 2026-09-21
- 1.32.10 — 2026-09-17
- 1.32.10-beta.1 — 2026-09-11
- 1.32.10-beta.0 — 2026-09-08
- 1.32.9 — 2026-09-08
- 1.32.9-beta.1 — 2026-09-08
- … 391 more at https://npm.io/package/@percy/logger/versions

## README

# @percy/logger

Common logger used throughout the Percy CLI and SDKs.

- [Usage](#usage)
  - [`logger()`](#loggerdebug)
  - [`logger.loglevel()`](#loggerloglevel)
  - [`logger.format()`](#loggerformat)
  - [`logger.query()`](#loggerquery)

## Usage

``` js
import logger from '@percy/logger'

const log = logger('foobar')

log.info('info message')
log.error('error message')
log.warn('warning message')
log.debug('debug message')
log.deprecated('deprecation message')
```

### `logger([debug])`

Creates a group of logging functions that will be associated with the provided `debug` label. When
debug logging is enabled, this label is printed with the `[percy:*]` label and can be filtered via
the `PERCY_DEBUG` environment variable.

``` js
PERCY_DEBUG="one:*,*:a,-*:b"

logger.loglevel('debug')

logger('one').debug('test')
logger('one:a').debug('test')
logger('one:b').debug('test')
logger('one:c').debug('test')
logger('two').debug('test')
logger('two:a').debug('test')

// only logs from the matching debug string are printed
//=> [percy:one] test
//=> [percy:one:a] test
//=> [percy:one:c] test
//=> [percy:two:a] test
```

### `logger.loglevel([level][, flags])`

Sets or retrieves the log level of the shared logger. If the second argument is provided, `level` is
treated as a fallback when all logging flags are `false`. When no arguments are provided, the method
will return the current log level of the shared logger.

``` js
logger.loglevel('info', { verbose: true })
logger.loglevel() === 'debug'

logger.loglevel('info', { quiet: true })
logger.loglevel() === 'warn'

logger.loglevel('info', { silent: true })
logget.loglevel() === 'silent'

logger.loglevel('info')
logger.loglevel() === 'info'
```

### `logger.format(message, debug[, level])`

Returns a formatted `message` depending on the provided level and logger's own log level. When
debugging, the `debug` label is added to the prepended `[percy:*]` label.

``` js
logger.format('foobar', 'test')
//=> [percy] foobar

logger.loglevel('debug')
logger.format('foobar', 'test', warn')
//=> [percy:test] foobar (yellow for warnings)
```

### `logger.query(filter)`

Returns an array of logs matching the provided filter function.

``` js
let logs = logger.query(log => {
  return log.level === 'debug' &&
    log.message.match(/foobar/)
})
```

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