npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@christian-wechsel/logger-middleware

v0.1.2

Published

Express 5 middleware for request logging with @christian-wechsel/logger.

Readme

@christian-wechsel/logger-middleware

Express middleware that logs incoming HTTP requests through @christian-wechsel/logger. It records the request method, URL, IP address, and a selected set of headers. Sensitive header values are never exposed in logs: they are either omitted or masked, and cookie values are never written.

Requirements

  • Node.js application using Express 5.
  • A logger implementing the Logger interface from @christian-wechsel/logger.
  • TypeScript users need the Express 5 type definitions from @types/express.

Installation

Install the middleware and its peer dependencies in your application:

npm install @christian-wechsel/logger-middleware express@^5 @christian-wechsel/logger
npm install --save-dev @types/express@^5

Peer dependencies

These packages are peer dependencies because the middleware plugs into the host application's Express setup and uses the logger selected by the application:

| Package | Required version | Purpose | | --- | --- | --- | | express | ^5.2.1 | Express application that installs and runs the middleware. | | @types/express | ^5.0.6 | Express request-handler types used by the package. | | @christian-wechsel/logger | ^0.2.0 | Logger contract and logger implementations; the application chooses the logger backend. |

Use a logger instance that implements info, warn, error, and debug. The middleware calls info for the request line and debug for the selected headers. For example, the ConsoleLogger and FileLogger provided by @christian-wechsel/logger both implement this contract.

Usage

import express from "express";
import { ConsoleLogger } from "@christian-wechsel/logger";
import { RequestLogger } from "@christian-wechsel/logger-middleware";

const app = express();
const logger = new ConsoleLogger("my-app");
const requestLogger = new RequestLogger(logger);

app.use(requestLogger.createRequestLogger());

RequestLogger receives the logger through its constructor, so the application retains control over formatting and the output destination. Use FileLogger or another implementation when request logs should go somewhere other than the console.

Sensitive headers

The middleware uses a strict allowlist and never logs arbitrary request headers. Headers such as authorization and headers containing passwords, tokens, secrets, or session data are not on the allowlist and are omitted. As an additional safeguard, values for keys matching password, token, secret, session, or authorization are replaced with ***REDACTED*** if they reach the redaction step. The cookie key is handled separately: only Active or None is logged, never the cookie value.

Logged data

For each request, the middleware writes an info message similar to:

Incoming Request: GET /health from 127.0.0.1

It also writes a debug message containing these available headers: x-forwarded-for, x-forwarded-proto, x-forwarded-host, x-real-ip, host, user-agent, referer, content-type, accept, and origin. Other headers are omitted. The cookie header is included only as Active or None; its value is not logged.

After logging, the middleware calls next() to continue the Express middleware chain. It does not log response status codes or response bodies.

License

MIT