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 🙏

© 2025 – Pkg Stats / Ryan Hefner

tablic-http-logger

v1.0.5

Published

A solid HTTP logger middleware for Express.js applications, also fully compatible with NestJS. This logger provides customizable, detailed logs with fields such as timestamp, HTTP method, URL, status, response time, client IP, user-agent, and more. The lo

Readme

HTTP Logger for Express.js & NestJS

A solid HTTP logger middleware for Express.js applications, fully compatible with NestJS. This logger provides customizable, detailed logs with fields such as timestamp, HTTP method, URL, status, response time, client IP, user-agent, and more. The log output is structured in a table-like format, allowing dynamic control over visible fields and timestamp formatting.

Features

  • Works seamlessly with both Express.js and NestJS.
  • Logs detailed request information such as:
    • Timestamp
    • HTTP Method
    • URL
    • HTTP Status Code
    • Response Time
    • Client IP
    • User-Agent
    • Referrer
    • Response Size
    • HTTP Version
  • Dynamic configuration to toggle the visibility of each field in the logs.
  • Customizable timestamp format (ISO or Locale Time).
  • Table-like log output with borders and styling for easy readability.

Installation

You can install the logger middleware using npm or yarn:

npm i tablic-http-logger

Available Configuration Options

You can customize the logger by passing options to the createHttpLogger function. Here's a list of available options and their explanations:

  • showTimestamp (boolean, default: true): Display the timestamp in the log.
  • showMethod (boolean, default: true): Display the HTTP method (GET, POST, etc.).
  • showUrl (boolean, default: true): Display the requested URL.
  • showStatus (boolean, default: true): Display the HTTP status code.
  • showResponseTime (boolean, default: true): Display the response time in milliseconds.
  • showClientIP (boolean, default: true): Display the client's IP address.
  • showUserAgent (boolean, default: true): Display the user-agent string.
  • showReferrer (boolean, default: true): Display the referrer (if available).
  • showResponseSize (boolean, default: true): Display the response size.
  • showHttpVersion (boolean, default: true): Display the HTTP version.
  • timeFormat (string, default: 'iso'): The format of the timestamp. Can be 'iso' for ISO format or 'short' for a more concise, human-readable local time.

Example Log Output

Screenshot 2025-03-02 at 11 29 00 PM

Screenshot 2025-03-02 at 11 28 19 PM

Usage in a Express.js App

const express = require('express');
const { createHttpLogger } = require('tablic-http-logger');

const app = express();

// Use the logger middleware
app.use(createHttpLogger({
  showTimestamp: true,  // Default: true
  showMethod: true,     // Default: true
  showUrl: true,        // Default: true
  showStatus: true,     // Default: true
  showResponseTime: true, // Default: true
  showClientIP: true,   // Default: true
  showUserAgent: true,  // Default: true
  showReferrer: true,   // Default: true
  showResponseSize: true, // Default: true
  showHttpVersion: true, // Default: true
  timeFormat: 'iso',    // Default: 'iso' (Can be 'iso' or 'short')
}));

// Example route
app.get('/', (req, res) => {
  res.send('Hello, world!');
});

app.listen(3000, () => {
  console.log('Server is running on port 3000');
});

Usage in a NestJS App

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

import { createHttpLogger } from 'tablic-http-logger';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.enableCors();

  app.use(createHttpLogger({
    // You can customize the logger options here
  }));

  await app.listen(process.env.PORT ?? 3000);
}
bootstrap();

Contribution

We welcome contributions to improve this project! Here are some ways you can contribute:

  • Bug Fixes: If you find a bug, please submit an issue on GitHub and, if possible, provide a fix in a pull request.
  • Feature Requests: Have an idea for a new feature? Open an issue with a description of the feature, and we can discuss it.
  • Code Improvements: Feel free to suggest or submit code improvements for better performance, cleaner code, etc.

Steps to Contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes.
  4. Run tests (if applicable) and ensure everything works as expected.
  5. Create a pull request with a detailed description of your changes.

License

This project is licensed under the MIT License.

Issues

If you encounter any issues or have questions, please feel free to open an issue on GitHub. Make sure to include relevant information such as error messages, system environment, and steps to reproduce the issue.