Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
A simple logger, which logs the request to server in form of tables, it helps to debug the connection with client and can also be used for metrics.
A library to log the HTTP requests coming to the server for debugging, testing and monitoring purposes.
This is mostly useful for debugging purposes, so to install it as a dev-dependency you can simply install the npm package with dev flag.
npm install --save-dev reqlogs
const express = require('express')
const app = express()
const PORT = process.env.PORT || 8081
// import the library
const {RequestLogger} = require('reqlogs')
// select the parameters you want to log from the HTTP request.
const parameters = {
time: true,
method: true,
path : true,
query : true,
body : true
}
// an array of paths you want the logger to ignore
const ignore_urls = ['/a', '/b']
// a boolean (optional) , for ordering of the data in table logs
const showLatestFirst = true
// create an object and pass the parameters
const RL = new RequestLogger({ignore_urls, parameters, showLatestFirst})
// essential middleware...
app.use(express.json())
app.use(express.urlencoded({extended:true}))
.
.
.
// put RL middlewares at the bottom just above the routes/api
app.use(RL.Console())
// specify the url for the webview
const url = '/logs'
app.use(RL.Webpage({url}))
app.use(API)
app.listen(PORT, () => {
console.log(`Server started at port : ${PORT}`)
})
Tip : This will work only if your server already has the required middlewares setup before the reqlogs middleware like cookies-parser for cookies and express.json() for body etc.
This will log your request data in form of tables in console and will render a webview as well.
Webview for an example server Console for an example server
FAQs
A simple logger, which logs the request to server in form of tables, it helps to debug the connection with client and can also be used for metrics.
The npm package reqlogs receives a total of 1 weekly downloads. As such, reqlogs popularity was classified as not popular.
We found that reqlogs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.