express-logging is an Express middleware designed to log incoming requests and outgoing responses. The current stable version is 1.1.1, released over eight years ago, indicating the project is no longer actively maintained. It allows for configurable logging using any logger that exposes an `info` method, such as `logops`, and supports blacklisting specific URL paths to prevent logging. A key differentiator is its 'policy' option, which enables logging in either a single 'message' string format or a 'params' object format, making it suitable for integration with log processing systems like ELK stack. It also automatically calculates and logs the duration of each request-response cycle. Given its age, it is likely incompatible with modern versions of Node.js and Express.
npm install express-loggingVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of `express-logging` with a standard logger and an example of configuring the middleware with custom blacklist paths and a 'params' logging policy.
Consider using a modern, actively maintained logging middleware for Express such as `morgan`, `pino-http`, or `winston-express`.
Migration to a contemporary logging solution is strongly recommended to ensure compatibility and leverage modern Node.js features.
Ensure your project is configured for CommonJS (`"type": "commonjs"` in package.json) or stick to `require()` syntax for this specific package. For ES module projects, choose an alternative middleware.
Ensure you are calling `expressLogging` with a logger argument (e.g., `app.use(expressLogging(logger));`) and that you are using `const expressLogging = require('express-logging');` in a CommonJS context.Verify that the logger object you are passing to `expressLogging` (e.g., `logger`) has a callable `info` method with the expected signature. For instance, `logops` provides this by default.