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

@kb-labs/adapters-pino-http

v2.94.0

Published

Pino HTTP transport for streaming logs to REST API

Downloads

515

Readme

@kb-labs/adapters-pino-http

Part of KB Labs ecosystem. Works exclusively within KB Labs platform.

Pino HTTP transport for streaming logs to KB Labs REST API.

Features

  • Batching - Configurable batch size and flush interval
  • Retry Logic - Exponential backoff on HTTP failures
  • Graceful Shutdown - Flushes pending logs before exit
  • Error Handling - Logs to stderr if HTTP fails
  • Lightweight - Minimal dependencies, uses native fetch

Installation

pnpm add @kb-labs/adapters-pino-http

Usage

Basic Setup

import pino from 'pino';

const logger = pino({
  transport: {
    target: '@kb-labs/adapters-pino-http',
    options: {
      url: 'http://localhost:5050/api/v1/logs/ingest',
      batchSize: 50,
      flushIntervalMs: 3000,
    },
  },
});

logger.info('Hello from Pino HTTP Transport!');

With Platform DI (Recommended)

Configure in .kb/kb.config.json:

{
  "platform": {
    "adapters": {
      "logger": "@kb-labs/adapters-pino"
    },
    "adapterOptions": {
      "logger": {
        "level": "info",
        "options": {
          "transport": {
            "target": "@kb-labs/adapters-pino-http",
            "options": {
              "url": "http://localhost:5050/api/v1/logs/ingest",
              "batchSize": 50,
              "flushIntervalMs": 3000
            }
          }
        }
      }
    }
  }
}

Then use in code:

import { initPlatform } from '@kb-labs/core-platform';

const platform = await initPlatform();

platform.logger.info('This log will be sent to REST API!', {
  plugin: 'my-plugin',
  executionId: 'exec-123',
});

Configuration

| Option | Type | Default | Description | |--------|------|---------|-------------| | url | string | http://localhost:5050/api/v1/logs/ingest | REST API endpoint for log ingestion | | batchSize | number | 50 | Number of logs to batch before sending | | flushIntervalMs | number | 3000 | Max time in ms to wait before flushing batch | | retryAttempts | number | 3 | Number of retry attempts on HTTP failure | | retryDelayMs | number | 1000 | Initial retry delay in ms (exponential backoff) | | headers | Record<string, string> | {} | Custom HTTP headers (e.g., for authentication) | | debug | boolean | false | Enable debug logging to stderr |

How It Works

  1. Pino logs are written to the transport stream
  2. Batch accumulation - Logs are collected into a batch
  3. Flush trigger - Batch is sent when:
    • Batch size reaches batchSize (immediate flush)
    • flushIntervalMs timer expires (delayed flush)
    • Process exits (graceful shutdown)
  4. HTTP POST - Batch is sent to REST API with retry logic
  5. Retry on failure - Exponential backoff (1s → 2s → 4s)
  6. Error logging - Failures are logged to stderr

Performance

  • Batching reduces HTTP overhead: 50 logs/request vs 50 requests
  • Non-blocking: Uses async fetch, doesn't block Pino
  • Memory-safe: Ring buffer in REST API prevents OOM

Debugging

Enable debug mode to see transport activity:

{
  "transport": {
    "target": "@kb-labs/adapters-pino-http",
    "options": {
      "url": "http://localhost:5050/api/v1/logs/ingest",
      "debug": true
    }
  }
}

Output:

[PinoHTTP] Flushing 50 logs to http://localhost:5050/api/v1/logs/ingest
[PinoHTTP] Flush successful
[PinoHTTP] Shutting down, flushing pending logs...
[PinoHTTP] Shutdown complete

License

KB Public License v1.1 - KB Labs Team