Skip to main content
Home
This release is 4 versions behind 1.0.4 — the latest version of @logtape/redaction. Jump to latest

@logtape/redaction@1.0.0-dev.262+96c86667
Built and signed on GitHub Actions

Data redaction for LogTape

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
3 weeks ago (1.0.0-dev.262+96c86667)
function redactByField
redactByField(
sink:
Sink
| Sink & Disposable
| Sink & AsyncDisposable
,
):
Sink
| Sink & Disposable
| Sink & AsyncDisposable

Redacts properties in a LogRecord based on the provided field patterns and action.

Note that it is a decorator which wraps the sink and redacts properties before passing them to the sink.

Examples

Example 1

import { getConsoleSink } from "@logtape/logtape";
import { redactByField } from "@logtape/redaction";

const sink = redactByField(getConsoleSink());

Parameters

sink:
Sink
| Sink & Disposable
| Sink & AsyncDisposable

The sink to wrap.

optional
options: FieldRedactionOptions | FieldPatterns = DEFAULT_REDACT_FIELDS

The redaction options.

Return Type

Sink
| Sink & Disposable
| Sink & AsyncDisposable

The wrapped sink.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@logtape/redaction

Import symbol

import { redactByField } from "@logtape/redaction";
or

Import directly with a jsr specifier

import { redactByField } from "jsr:@logtape/redaction";

Add Package

pnpm i jsr:@logtape/redaction
or (using pnpm 10.8 or older)
pnpm dlx jsr add @logtape/redaction

Import symbol

import { redactByField } from "@logtape/redaction";

Add Package

yarn add jsr:@logtape/redaction
or (using Yarn 4.8 or older)
yarn dlx jsr add @logtape/redaction

Import symbol

import { redactByField } from "@logtape/redaction";

Add Package

vlt install jsr:@logtape/redaction

Import symbol

import { redactByField } from "@logtape/redaction";

Add Package

npx jsr add @logtape/redaction

Import symbol

import { redactByField } from "@logtape/redaction";

Add Package

bunx jsr add @logtape/redaction

Import symbol

import { redactByField } from "@logtape/redaction";