npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

winston-transport-pg

v0.1.1

Published

A PostgreSQL Transport for the Winston Logger

Readme

winston-transport-pg

A PostgreSQL Transport for Winston Logger (v3.x).

Uses the node-postgres package, and does not require native binding (libpq) to be installed on the host machine.

Inspired by winston-pg-native.

Prerequisite

You must have a table that matches the following description:

CREATE TABLE logs (
  timestamp TIMESTAMP WITH TIME ZONE DEFAULT now(),
  level VARCHAR,
  message VARCHAR,
  meta JSON
);

Installation

npm i winston-transport-pg

Use

To create an instance of the PostgresTransport, we need two things:

  1. A pg Pool instance
  2. An IPostgresTransportOptions object

IPostgresTransportOptions

Below is the interface for the IPostgresTransportOptions object.

interface IPostgresTransportOptions {
  level?: string;
  tableName: string;
}

Creating an Instance

import { Pool } from 'pg';
import { createLogger, format } from 'winston';

// First create a Pool instance.
const pool = new Pool('postgres://username:password@hostname:5432/database');

// Set up our options.
const opts = {
  level: 'info',
  tableName: 'logs',
};

// Create the instance.
const postgresTransport = new PostgresTransport(pool, opts);

// Add Transport to Logger
const logger = createLogger({
  format: format.json(),
  transports: [ postgresTransport ]
});