# @sliit-foss/http-logger

> Http logging middleware for Express.js

Latest version **2.0.0** (published 2025-04-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @sliit-foss/http-logger
pnpm add @sliit-foss/http-logger
yarn add @sliit-foss/http-logger
bun add @sliit-foss/http-logger
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2025-04-20 |
| First published | 2023-04-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 8 |
| Author | SLIIT FOSS |
| Maintainers | sliit.foss |
| Keywords | logging, http-logging, middleware |

## Links

- npm: https://www.npmjs.com/package/@sliit-foss/http-logger
- Repository: https://github.com/sliit-foss/npm-catalogue
- Homepage: https://github.com/sliit-foss/npm-catalogue/blob/main/packages/http-logger/readme.md
- Issues: https://github.com/sliit-foss/npm-catalogue/issues
- npm.io page: https://npm.io/package/@sliit-foss/http-logger

## Dependencies (1)

- [@sliit-foss/module-logger](https://npm.io/package/@sliit-foss/module-logger.md) 2.0.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2025-04-20
- 1.1.0-blizzard.0 (blizzard) — 2023-07-22
- 1.4.0 — 2025-02-02
- 1.3.1 — 2024-02-27
- 1.3.0 — 2024-02-27
- 1.2.2 — 2024-01-14
- 1.2.1 — 2024-01-07
- 1.2.0 — 2024-01-07
- 1.1.2 — 2023-07-28
- 1.1.1 — 2023-07-22
- 1.1.0 — 2023-07-22
- 1.0.1 — 2023-04-01
- 1.0.0 — 2023-04-01

## README

# @sliit-foss/http-logger

### Http logging middleware for Express.js

<br/>

## Installation

```js
# using npm
npm install @sliit-foss/http-logger

# using yarn
yarn add @sliit-foss/http-logger
```

## Usage

```js
# using require
const httpLogger = require("@sliit-foss/http-logger").default;

# using import
import httpLogger from "@sliit-foss/http-logger";
```

## Example<br/><br/>

```js
import app from "express";

app.use(httpLogger());
```

## Usage With Options<br/><br/>

```js
import app from 'express';

app.use(httpLogger({
  whitelists: ["/public/*"] // An array of paths to exclude being logged if needed
  loggable: [
    "body"
  ], // An array of extra propeties in the request object to log. Defaults to the following: ['path', 'method', 'query', 'params']
}));

// or
import { pick, omit} from 'loadash';

app.use(httpLogger({
  whitelists: ["/public/*"],
  loggable: ( (req) => {
    // Pick the properties you want to log
    return {
      headers: pick(req.headers, ['x-user-email', 'user-agent']),
      payload: omit(req.body, ['password', 'new_password', 'old_password'])
    }
  }),
}));
```

---
_Source: https://npm.io/package/@sliit-foss/http-logger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
