UNPKG

js-mvc-app

Version:

A CLI tool to scaffold complete Node.js MVC projects with TypeScript, just like Laravel

39 lines (36 loc) 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getJavaScriptLogger = getJavaScriptLogger; function getJavaScriptLogger() { return `const winston = require('winston'); const logger = winston.createLogger({ level: process.env.LOG_LEVEL || 'info', format: winston.format.combine( winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston.format.errors({ stack: true }), winston.format.json() ), defaultMeta: { service: 'node-mvc-app' }, transports: [ // Write all logs with importance level of \`error\` or less to \`error.log\` new winston.transports.File({ filename: 'logs/error.log', level: 'error' }), // Write all logs with importance level of \`info\` or less to \`combined.log\` new winston.transports.File({ filename: 'logs/combined.log' }) ] }); // If we're not in production then log to the \`console\` with the format: // \`info: message JSON_OBJECT\` if (process.env.NODE_ENV !== 'production') { logger.add(new winston.transports.Console({ format: winston.format.combine( winston.format.colorize(), winston.format.simple() ) })); } module.exports = logger; `; } //# sourceMappingURL=utils.js.map