{"id":42537,"library":"connect-request-logger-pg","title":"connect-request-logger-pg","description":"An Express/Connect middleware that logs HTTP request details directly to a PostgreSQL database with automatic monthly table partitioning. Version 0.0.7 is the last release on npm; the project appears to be unmaintained (no commits since 2013, no activity on GitHub). It supports custom fields from the request object and uses pg-native or pg as the PostgreSQL client. Alternatives include pino-http and morgan with PostgreSQL transport, which are actively maintained.","status":"abandoned","version":"0.0.7","language":"javascript","source_language":"en","source_url":"git://github.com/goodybag/connect-request-logger-pg","tags":["javascript","http","express","connect","postgres","logging","logger","requests","middleware"],"install":[{"cmd":"npm install connect-request-logger-pg","lang":"bash","label":"npm"},{"cmd":"yarn add connect-request-logger-pg","lang":"bash","label":"yarn"},{"cmd":"pnpm add connect-request-logger-pg","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required to communicate with PostgreSQL. Must be installed separately as a peer dependency.","package":"pg","optional":false},{"reason":"Alternative PostgreSQL client; if pg-native is installed, it is preferred over pg.","package":"pg-native","optional":true}],"imports":[{"note":"ESM named default import, not named export.","wrong":"const connectReqLogPg = require('connect-request-logger-pg');","symbol":"default","correct":"import connectReqLogPg from 'connect-request-logger-pg';"},{"note":"CommonJS require gives the default export directly.","wrong":"const logger = require('connect-request-logger-pg').default;","symbol":"express","correct":"const logger = require('connect-request-logger-pg');"},{"note":"The module exports a factory function directly, not a named export.","wrong":"app.use(connectReqLogPg.logger(...));","symbol":"middleware usage","correct":"app.use(logger({ connectionString: '...', tableName: 'logs' }));"}],"quickstart":{"code":"import express from 'express';\nimport logger from 'connect-request-logger-pg';\n\nconst app = express();\n\napp.use(logger({\n  connectionString: process.env.DATABASE_URL ?? 'postgres://user:pass@localhost/mydb',\n  tableName: 'http_logs'\n}));\n\napp.get('/', (req, res) => {\n  res.send('Hello World!');\n});\n\napp.listen(3000);","lang":"typescript","description":"Sets up Express app with the middleware logging requests to PostgreSQL with automatic table partitioning."},"warnings":[{"fix":"Migrate to a supported logging middleware (e.g., pino-http).","message":"This package has not been updated since 2013 and is effectively unmaintained. Use actively maintained alternatives like pino-http or morgan with PostgreSQL transport.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Install either `pg` or `pg-native` as a dependency.","message":"The package prefers pg-native over pg. If pg-native is installed, it will be used; otherwise pg must be installed. Ensure at least one PostgreSQL client is available.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pass a connected client: `logger({ client: someClient })` instead of a pool.","message":"The log function expects a connection object with a `query` method. If using a custom pool, you must pass a client instance, not a pool.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use CommonJS `require()` or ensure your project is configured to handle CJS dependencies.","message":"The module does not support ESM natively. Using `import` may require a bundler or Node.js --experimental-modules flag (Node < 14).","severity":"breaking","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.0.7':25 '2013':41 'activ':43,77 'altern':65 'appear':34 'automat':20 'client':64 'commit':39 'connect':2,82 'connect-request-logger-pg':1 'custom':48 'databas':18 'detail':13 'direct':14 'express':81 'express/connect':7 'field':49 'github':45 'http':11,69,80 'includ':66 'javascript':79 'last':28 'log':10,84 'logger':4,85 'maintain':78 'middlewar':8,87 'month':21 'morgan':71 'nativ':58 'npm':31 'object':53 'partit':23 'pg':5,57,60 'pg-nativ':56 'pino':68 'pino-http':67 'postgr':83 'postgresql':17,63,73 'project':33 'releas':29 'request':3,12,52,86 'sinc':40 'support':47 'tabl':22 'transport':74 'unmaintain':37 'use':55 'version':24","created_at":"2026-06-05T16:55:28.228338+00:00","updated_at":"2026-06-05T16:55:28.228338+00:00","problems":[{"fix":"Run `npm install pg` to install the pg module.","cause":"Missing required PostgreSQL client dependency.","error":"ERROR: Cannot find module 'pg'"},{"fix":"Obtain a client from the pool: `pool.connect().then(client => { ... })` and pass that client.","cause":"Passed a pool instance instead of a client instance to the middleware.","error":"TypeError: client.query is not a function"},{"fix":"Invoke logger with options: `app.use(logger({ ... }))`.","cause":"Using logger without calling the factory function (e.g., `app.use(logger)` instead of `app.use(logger(...))`).","error":"Error: Connect middleware expects function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"git://github.com/goodybag/connect-request-logger-pg","github":"git://github.com/goodybag/connect-request-logger-pg","docs":null,"changelog":null,"pypi":null,"npm":"connect-request-logger-pg","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}