UNPKG

@visulima/pail

Version:

Highly configurable Logger for Node.js, Edge and Browser.

27 lines (24 loc) 781 B
'use strict'; var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); class RedactProcessor { static { __name(this, "RedactProcessor"); } #redact; constructor(rules, options) { try { const { redact, standardRules } = require("@visulima/redact"); this.#redact = (input) => redact(input, rules || standardRules, options); } catch { throw new Error("The '@visulima/redact' package is missing. Make sure to install the '@visulima/redact' package."); } } process(meta) { meta.message = this.#redact(meta.message); meta.context = this.#redact(meta.context); meta.error = this.#redact(meta.error); return meta; } } module.exports = RedactProcessor;