@salesforce/core
Version:
Core libraries to interact with SFDX projects, orgs, and APIs.
30 lines • 1.06 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemoryLogger = void 0;
/*
* Copyright (c) 2023, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
const node_stream_1 = require("node:stream");
const unwrapArray_1 = require("../util/unwrapArray");
const filters_1 = require("./filters");
/**
* Used by test setup to keep UT from writing to disk.
*/
class MemoryLogger extends node_stream_1.Writable {
loggedData = [];
constructor() {
super({ objectMode: true });
}
_write(chunk, encoding, callback) {
const filteredChunk = (0, unwrapArray_1.unwrapArray)((0, filters_1.filterSecrets)([chunk]));
this.loggedData.push(typeof filteredChunk === 'string'
? JSON.parse(filteredChunk)
: filteredChunk);
callback();
}
}
exports.MemoryLogger = MemoryLogger;
//# sourceMappingURL=memoryLogger.js.map
;