UNPKG

log-vault

Version:

A generator of Winston logger instance with pre-defined configurable transports and formats and extra functionality.

19 lines (18 loc) 675 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatNotifications = void 0; const winston_1 = require("winston"); exports.formatNotifications = (0, winston_1.format)((info) => { const { timestamp, level, meta, message, extra } = info; let formattedMessage = message; if (extra === null || extra === void 0 ? void 0 : extra.length) formattedMessage = [message, ...extra]; // if (!["number", "string"].includes(typeof formattedMessage)) // formattedMessage = JSON.stringify(formattedMessage, null, 2); return { timestamp, level, meta, message: formattedMessage }; });