# @map-colonies/express-access-log-middleware

> An access and error logger for express based on pino-http

Latest version **5.0.0** (published 2026-07-14) · 0 weekly downloads

## Install

```sh
npm install @map-colonies/express-access-log-middleware
pnpm add @map-colonies/express-access-log-middleware
yarn add @map-colonies/express-access-log-middleware
bun add @map-colonies/express-access-log-middleware
```

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2026-07-14 |
| First published | 2021-04-11 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=24 |
| Dependencies | 3 |
| Unpacked size | 14.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Maintainers | mapcolonies, syncush, asaf.masa, schnitz, konchashlomicl, shimoncohen, alebinson, netanelc, mapcolonies.devops, konchashlomi, ronenk |

## Links

- npm: https://www.npmjs.com/package/@map-colonies/express-access-log-middleware
- Repository: github:MapColonies/infra-packages
- npm.io page: https://npm.io/package/@map-colonies/express-access-log-middleware

## Dependencies (3)

- [pino-http](https://npm.io/package/pino-http.md) ^11.0.0
- [http-status-codes](https://npm.io/package/http-status-codes.md) ^2.3.0
- [@opentelemetry/semantic-conventions](https://npm.io/package/@opentelemetry/semantic-conventions.md) ^1.38.0

## Recent versions

- 5.0.0 (latest) — 2026-07-14
- 4.1.0 — 2026-03-08
- 4.0.0 — 2026-01-18
- 3.0.1 — 2025-02-03
- 3.0.0 — 2024-11-25
- 2.1.0 — 2024-10-27
- 2.0.1 — 2023-04-04
- 2.0.0 — 2023-04-03
- 1.0.0 — 2022-05-18
- 0.0.3 — 2021-04-26
- 0.0.2 — 2021-04-22
- 0.0.1 — 2021-04-11

## README

# express-access-log-middleware

An access and error logger for express based on [pino-http](https://github.com/pinojs/pino-http).

## API documentation

Check the autogenerated documentation [here](https://mapcolonies.github.io/infra-packages/modules/_map-colonies_express-access-log-middleware.html).

## Usage

```typescript
import * as express from 'express';
import { jsLogger } from '@map-colonies/js-logger';
import { httpLogger } from '@map-colonies/express-access-log-middleware';

const app = express();

const logger = jsLogger();

app.use(httpLogger({ logger }));

app.get('/', (req, res) => {
  res.json({ hello: 'world' });
});

app.listen(8080);
```

for more detailed usage check the [pino-http documentation](https://github.com/pinojs/pino-http).

###

## Configuration

| name                 | type                                                                | default value                   | description                                                                 |
| -------------------- | ------------------------------------------------------------------- | ------------------------------- | --------------------------------------------------------------------------- |
| logger               | Logger                                                              | required                        | The logger instance used for logging requests and responses                 |
| ignorePaths          | (string \| RegExp)[]                                                | undefined                       | Array of paths or regular expressions to ignore from logging                |
| ignore               | AutoLoggingOptions['ignore']                                        | undefined                       | Custom ignore options for automatic logging                                 |
| customLogLevel       | (req, res, err) => LogLevel                                         | error for >=400, info otherwise | Custom function to determine log level based on request, response and error |
| customSuccessMessage | (res: ServerResponse) => string                                     | undefined                       | Custom function to generate success messages                                |
| customSuccessObject  | (req: IncomingMessage, res: ServerResponse, val: any) => object     | undefined                       | Custom function to modify the success log object                            |
| customErrorMessage   | (error: Error, res: ServerResponse) => string                       | undefined                       | Custom function to generate error messages                                  |
| customErrorObject    | (req: IncomingMessage, res: ServerResponse, error: Error) => object | undefined                       | Custom function to modify the error log object                              |

---
_Source: https://npm.io/package/@map-colonies/express-access-log-middleware · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
