
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
express-request-logger
Advanced tools
An easy way to create a key/value pair list to be logged on each request in express.
$ cd /path/to/your/project
$ npm install express-request-logger
This package is meant to be used as middleware for a web app using Express. It will allow you to create a key/value pair list of data to get logged per request. Using this it can output data to allow you to analyze how your web app is being used.
Since response time is a part of the logging output, express-request-logger should be put as early in the middleware chain as possible.
var winston = require('winston');
var reqLogger = require('express-request-logger');
var logger = new (winston.Logger)({ transports: [ new (winston.transports.Console)() ] });
app.use(reqLogger.create(logger));
The req
object will now have a kvLog
object that can have extra data added to it. At the end of the request it will be logged with all the other data collected.
function (req, res, next) {
// ...
req.kvLog.action = 'test';
// ...
}
The key message
is special, it will be removed from the object and be sent to the logger as the true message. It is optional, so if it is not included, the log will just contain an empty message.
Currently it is recommended to use winston as the logger object, but any object that can be called like loggerObj.log(level, message, {key: value})
will work.
FAQs
Log anything you want per request
The npm package express-request-logger receives a total of 130 weekly downloads. As such, express-request-logger popularity was classified as not popular.
We found that express-request-logger 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.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.