Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
simple-express-logs
Advanced tools
Readme
Simple express logging middleware
Are you prototyping an Express app and want a simple way to log all requests? Good news, you're looking at it.
$ npm install --save simple-express-logs
const express = require('express');
const logger = require('simple-express-logs');
const app = express();
app.use(logger());
Or, in one line:
app.use(require('simple-express-logs')());
By default, simple-express-logs
outputs a timestamp, whether the request was made over HTTP or HTTPS, the HTTP verb, the path, the source IP, and the reverse DNS host (if available.)
20:06 1/15/2019 UTC: https POST /api/items/ from 24.63.26.119
5:17 1/8/2019 UTC: https GET /favicon.ico from 66.249.66.152 (crawl-66-249-66-152.googlebot.com)
20:06 1/15/2019 UTC: http GET / from 24.63.26.119 (c-24-63-26-119.hsd1.ma.comcast.net) referred by https://www.google.com
20:06 1/15/2019 UTC: http GET /style.css from 24.63.26.119 (c-24-63-26-119.hsd1.ma.comcast.net)
Both the the header values and request body are not logged by default, but may be enabled when adding the middleware.
app.use(logger({ headers: true }));
23:15 1/25/2019 UTC: http POST /api/test/?type=sample Headers: { host: "localhost:8080", user-agent: "HTTPie/0.9.9", accept-encoding: "gzip, deflate", accept: "application/json, */*", connection: "keep-alive", content-type: "application/json", content-length: "24" }
Logging the body relies on the body
property of the request to be populated, so make sure to do that before using the logger.
app.use(bodyParser.json());
app.use(logger({ body: true }));
23:15 1/25/2019 UTC: http POST /api/test/?type=sample Body: {"VehicleColor":"Blue"}
By default, reverse DNS is used to log the request's host.
app.use(logger());
5:17 1/8/2019 UTC: https GET /favicon.ico from 66.249.66.152 (crawl-66-249-66-152.googlebot.com)
This can be disabled with the reverseDNS
option.
app.use(logger({ reverseDNS: false }));
5:17 1/8/2019 UTC: https GET /favicon.ico from 66.249.66.152
MIT © Jesse T Youngblood
FAQs
Simple request logging middleware for Express
The npm package simple-express-logs receives a total of 0 weekly downloads. As such, simple-express-logs popularity was classified as not popular.
We found that simple-express-logs 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.