Skip to main content

HTTP Ledger

Production-ready Express middleware for comprehensive API logging with security, performance optimization, and TypeScript support

Why HTTP Ledger?

HTTP Ledger is designed for production environments where you need comprehensive API logging without compromising security or performance. It captures every detail of your HTTP requests and responses while giving you fine-grained control over what gets logged.

Secure by Default

Built-in field masking protects sensitive data like passwords and tokens

Performance Optimized

Log sampling and selective logging reduce overhead in high-traffic environments

TypeScript Native

Full TypeScript support with comprehensive type definitions

Flexible Integration

Custom formatters, log levels, and callbacks for any logging infrastructure

Key Features

Comprehensive Logging

Captures method, URL, status code, timing, sizes, headers, query params, and bodies

Field Masking

Automatically masks sensitive fields in requests and responses

Request Tracking

Auto-generate request IDs for distributed tracing

Custom Formatters

Transform log data with custom formatters before output

Log Sampling

Sample logs to reduce volume in high-traffic applications

IP Geolocation

Optional IP information enrichment for geographic analysis

Quick Start

Install HTTP Ledger and start logging in minutes:
npm install http-ledger
Add it to your Express application:
const express = require('express');
const logger = require('http-ledger');

const app = express();

// Basic usage with default settings
app.use(logger());

// Advanced usage with security and performance features
app.use(logger({
  maskFields: ['password', 'token', 'secret'],
  logSampling: 0.1, // Log 10% of requests
  autoGenerateRequestId: true
}));

app.listen(3000);

What You’ll Learn

Installation

Install HTTP Ledger with npm, yarn, or pnpm

Quickstart

Get logging in your Express app in 5 minutes

Configuration

Explore all configuration options

API Reference

Complete API documentation

Built for Production

HTTP Ledger is optimized for production use with features like:
  • Minimal Overhead: Optimized for high-performance applications
  • Graceful Error Handling: Continues logging even if components fail
  • Memory Efficient: Streams large responses without buffering
  • Async-Safe: Non-blocking IP info fetching and callbacks

Production Setup Guide

Learn best practices for deploying HTTP Ledger in production environments

Build docs developers (and LLMs) love