Step by Step Guideline
logging
activity in node app.- Create specific log file every hour
- Easy configure log file round (Hourly, daily)
- Easy configure log file size
- Delete log files after specific days
- Environment specific log structure
Clone the repository
git clone https://github.com/bmshamsnahid/Manage-Node-App-Environment
Install dependencies
npm i
Import the logger.js
file in your desired place, in my case example.js
and invoke it.
const logger = require('./logger');
logger.info('Info log example');
Now run example.js
node example.js
To integrate with morgan
const express = require('express');
const morgan = require('morgan');
const logger = require('./logger');
const app = express();
app.use(morgan('tiny', { stream: logger.stream }));
Now morgan will put each route information in log file.
Go to logger.js
file and update configurations.
MIT