# @onflow/util-logger

> Logger for FCL-JS

Latest version **1.3.4** (published 2025-09-08) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @onflow/util-logger
pnpm add @onflow/util-logger
yarn add @onflow/util-logger
bun add @onflow/util-logger
```

## Health

**Score 65/100 (B)** — status: stable.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.3.4 |
| Published | 2025-09-08 |
| First published | 2022-04-04 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 56.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 333 |
| Author | Flow Foundation |
| Maintainers | han210, dapperj, dapper_labs, jeffreydoyle, harry.eth, turbolent_flow, chasefleming, gregsantos, gregorggg, jribbink, bthaile, nialexsan, sisyphussmiling, lmcmze |

## Links

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

## Dependencies (1)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.25.7

## Recent versions

- 1.3.4 (latest) — 2025-09-08
- 1.3.3-alpha.0 (alpha) — 2024-10-22
- 1.3.2-event-streaming.1 (event-streaming) — 2023-11-29
- 1.3.0-typescript.0 (typescript) — 2023-11-01
- 1.3.3 — 2024-11-27
- 1.3.2 — 2024-03-26
- 1.3.2-alpha.2 — 2023-12-07
- 1.3.2-alpha.1 — 2023-12-07
- 1.3.2-alpha.0 — 2023-12-04
- 1.3.2-event-streaming.0 — 2023-11-29
- 1.3.1 — 2023-11-09
- 1.3.0 — 2023-10-22
- 1.2.2 — 2023-09-01
- 1.3.0-alpha.0 — 2023-08-04
- 1.2.1 — 2023-08-03
- … 19 more at https://npm.io/package/@onflow/util-logger/versions

## README

# @onflow/util-logger

Logger for FCL-JS.

# Status

- **Last Updated:** March 30 2022
- **Stable:** Yes
- **Risk of Breaking Change:** No

# Install

```bash
npm install --save @onflow/util-logger
```

# Usage

## Logger Levels

| Name    | Value |
| ------- | ----- |
| `error` |   1   |
| `warn`  |   2   |
| `log`   |   3   |
| `info`  |   4   |
| `debug` |   5   |

```javascript
import * as logger from "@onflow/util-logger"

// This will fire if the config "logger.level" value is set to the error level or above
logger.log({
  title: "Title of error", 
  message: "Message body", 
  level: logger.LEVELS.error
})
```

## Deprecation

This package also exposes a useful method for logging deprecation warnings via `log.deprecate`.  The function accepts an object with the following keys as its parameters.

 - `pkg` (optional) - The package which the deprecated feature belongs to (i.e. `FCL/SDK`, `@onflow/util-invariant`, etc.).  If not provided it defaults to an empty string and will not show in the notice.
 - `subject` (optional) - The feature that is being deprecated (i.e. `"Passing a start and end into getEvents"`).
 - `transition`  (optional) - The URL to the transition guide for the deprecation
 - `level` (optional) - The [logger level](https://github.com/onflow/fcl-js/tree/master/packages/util-logger#logger-levels) of the deprecation notice (default LEVELS.warn)
 - `message` (optional) - An additional message to provide the user about the deprecation.  Will ap
 - `callback` (optional) -

Deprecation notice format:
```javascript
 `${pkg} Deprecation Notice
============================

${subject} is deprecated and will cease to work in future releases of ${pkg}.
${message}
You can learn more (including a guide on common transition paths) here: ${transition}

============================`
```
The lines with `subject`, `message`, and `transition` will not appear if these values are not provided.  
  
Example usage:
```javascript
import * as logger from "@onflow/util-logger"

logger.log.deprecate({
  pkg: "FCL/SDK",
  subject: "Passing a start and end into getEvents",
  transition:
    "https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0005-deprecate-start-end-get-events-builder",
})
```

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