Registry / http-networking / logger-request

logger-request

JSON →
library3.8.0jsnpmunverified

logger-request is an HTTP request logging middleware for Node.js, primarily designed for Express applications. It leverages the Winston logging library (specifically Winston v2.3.1 as of its last release, 3.8.0) to provide flexible output options including file logging, console output, and integration with other Winston transports like MongoDB. Key features include daily log rotation, customizable log fields such as process ID, referrer, authentication status, transfer rates, and user agent. The package reached its latest version, 3.8.0, in 2017, and has not received updates since, making it incompatible with modern Node.js versions and the significantly evolved Winston v3+ ecosystem. Its release cadence was active in the mid-2010s but has ceased, rendering it effectively unmaintained.

npm install logger-request
INSTALL
IMPORT
SIG · LOGGER-REQUEST
L
logger-request
http-networkingjavascriptv3.8.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

logger
import logger from 'logger-request'
const { logger } = require('logger-request')
The package primarily uses CommonJS `require()`. While `import logger from 'logger-request'` might work in some transpiled environments, native ESM is not officially supported and its main export is a default function. CommonJS is the intended usage.
LoggerMiddleware
const logger = require('logger-request'); app.use(logger(options));
import { LoggerMiddleware } from 'logger-request'
The package exports a function directly which acts as Express middleware, not a named export. The most common usage pattern is requiring the module and then invoking the returned function.

Demonstrates basic Express integration, setting up the middleware to log requests to both a daily rotating file (`app.log`) and the console with custom fields.

const express = require('express'); const logger = require('logger-request'); const app = express(); // Configure the logger to write to 'app.log' and also display to console app.use(logger({ filename: 'app.log', console: true, daily: true, // Rotate log file daily winston: { level: 'info', json: true, timestamp: true }, custom: { pid: true, // Log process ID referer: true, // Log HTTP referer header agent: true // Log user-agent header } })); app.get('/', (req, res) => { res.send('Hello World!'); }); app.listen(3000, () => { console.log('Server running on port 3000'); });
Debug
Known issues
breakingThe package is hardcoded to use Winston v2.3.1. It is not compatible with Winston v3.x or later due to significant API changes in Winston's major versions. Attempting to use a newer Winston version will result in errors.
fix
Downgrade Winston to a compatible v2.x version if you must use this package, or migrate to a modern logging solution that supports Winston v3+.
affects: >=3.0.0
breakingThe package has not been updated since 2017 and has a Node.js engine requirement of `>=4`. It is not officially tested or supported on modern Node.js versions and may encounter runtime issues or security vulnerabilities.
fix
Consider migrating to a currently maintained HTTP request logger middleware for modern Node.js environments.
affects: >=3.8.0
gotchaThe `deprecated` option within the `logger(options)` object does not indicate a deprecation of the package itself or a feature. Instead, it's a flag (default `false`) that alters the timing of log writing from the default `listener` to after `res.end()` (if `true`). This naming can be confusing.
fix
Understand that `options.deprecated` controls log timing, not feature deprecation. Use `false` for default behavior (logging on listener) or `true` for logging after response ends.
affects: >=3.0.0
Errors
Common errors & fixes
TypeError: logger.transports.Console is not a constructor
This error typically occurs when `logger-request` (which depends on Winston v2) is run in an environment where Winston v3 or later is also present or mistakenly assumed. Winston v3 changed its transport architecture significantly.
fix
Ensure that your `node_modules` only contains `winston@2.x` if you intend to use `logger-request`. If your project requires Winston v3+, you must migrate away from `logger-request`.
Error: Cannot find module 'winston'
`winston` is a peer dependency (or strong runtime dependency) of `logger-request` and must be installed explicitly in your project.
fix
Install winston: `npm install winston@2` (to match the version `logger-request` expects) or `npm install winston` if you are using an older npm that resolves peer dependencies automatically.
TypeError: app.use requires middleware functions but got a [object Undefined]
This error can occur if `require('logger-request')` returns `undefined`, which might happen if the package's main file is not found or has an error during loading.
fix
Verify that `logger-request` is correctly installed via `npm install logger-request`. Check for any installation errors or conflicts in your `node_modules` directory.
Upgrade
Version history
3.8.0latest on npm
Audit
Dependencies
winstonrequiredCore logging library, specifically requires v2.3.1. Modern Winston (v3+) is not compatible.
winston-daily-rotate-filerequiredProvides daily log rotation functionality, requires v1.4.6.
basic-authenticationoptionalUsed to log authentication details if the `custom.auth` option is enabled, requires v1.9.0.
transfer-rateoptionalUsed to log transfer rates if the `custom.transfer` option is enabled, requires v2.1.0.
Agent activity
22 hits · last 30 days
node
18
OpenAI (training)
2
Resources
logger-request — npm install logger-request · libregistry