Skip to content

A lightweight Express middleware for intercepting REST calls and log them into a file.

License

Notifications You must be signed in to change notification settings

3xl/express-rest-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Express REST logger

A lightweight Express middleware for intercepting REST calls and log them into a file.

Version

0.0.3

Installation

$ npm install --save express-rest-logger

Config

Key Default Description
path ./logs The folder used to store the log files.
file log.txt The name of the file.
dateFormat YYYY/M/D H:m:s The format of the date of each REST call stored in the log file. Follow the Moment.js documentation to customize it.

Usage

const express = require('express');
const logger = require('express-rest-logger');

const app = express();

app.use(logger({
    path: 'logs-folder',
    file: 'log-filename',
    dateFormat: 'YYYY/M/D'
}));

app.get('/', (req, res) => {
   res.json({
       data: 'test data'
   });
});

app.listen('3000', () => {
    console.log('Application started');
});

License

MIT

About

A lightweight Express middleware for intercepting REST calls and log them into a file.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published