@netlify/content-engine
Version:
29 lines • 1.13 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.patchConsole = patchConsole;
/*
* This module is used to patch console through our reporter so we can track
* these logs
*/
const util_1 = __importDefault(require("util"));
function patchConsole(reporter) {
console.log = (...args) => {
const [format, ...rest] = args;
reporter.log(util_1.default.format(format === undefined ? `` : format, ...rest));
};
console.warn = (...args) => {
const [format, ...rest] = args;
reporter.warn(util_1.default.format(format === undefined ? `` : format, ...rest));
};
console.info = (...args) => {
const [format, ...rest] = args;
reporter.info(util_1.default.format(format === undefined ? `` : format, ...rest));
};
console.error = (format, ...args) => {
reporter.error(util_1.default.format(format === undefined ? `` : format, ...args));
};
}
//# sourceMappingURL=patch-console.js.map
;