UNPKG

generator-restgoose

Version:

Modern, Lightweight, and Powerfull Rest API Code generator. Out-Of-Box NodeJS REST API Server generator built on top of Mongoose, Express, Cors, Passport, JWT and many more.

27 lines (21 loc) 557 B
const morgan = require('morgan'); const rfs = require('rotating-file-stream'); const debug = require('debug')('App:Plugin'); const API = {}; API.Config = {}; API.Init = (Config, app) => { API.Config = Config; debug('Loading Plugin : Logger'); // Console Log app.use(morgan(API.Config.predefined)); const accessLogStream = rfs('access.log', { interval: API.Config.rotation, // rotate daily path: API.Config.pathAccess.toString() }); app.use( morgan('short', { stream: accessLogStream }) ); }; module.exports = API;