UNPKG

@szegedsw/lib-node

Version:

A little framework published by Szeged Software Zrt. in order to enhance api endpoint security and create reuseable code. Email module, Logging system, and much more. Further improvements are expected.

20 lines 871 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.consoleHandler = void 0; const export_1 = require("../email/export"); // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types function consoleHandler() { ["warn", "error"].forEach((methodName) => { const originalMethod = console[methodName]; console[methodName] = (...args) => { var _a; if (methodName === "error") { const localArgs = String((_a = args[0].stack) === null || _a === void 0 ? void 0 : _a.split("\n").concat(Array.from(args).slice(1)).join("\n")); export_1.EmailService.sendEventEmail("ERROR", localArgs); } originalMethod.apply(console, args); }; }); } exports.consoleHandler = consoleHandler; //# sourceMappingURL=console-handler.js.map