tekir
All Packages
Utilitiesv0.1.4

@tekir/logger-loki

Grafana Loki transport for @tekir/logger.

Installation

$bun add @tekir/logger-loki

Features

  • Pushes logs to Grafana Loki endpoint
  • Configurable labels for log streams
  • Basic auth and custom headers
  • Batched delivery for performance
  • Works with any Loki-compatible backend

Quick Example

TypeScript
import { createLogger } from '@tekir/logger'
import { LokiTransport } from '@tekir/logger-loki'

const logger = createLogger({
  transports: [new LokiTransport({
    host: 'http://localhost:3100',
    labels: { app: 'my-api' },
  })],
})

Changelog

v0.1.4LatestSeptember 16, 2026
  • Published output now uses the shared Node-targeted ESM bundle pipeline with external dependencies and generated TypeScript declarations, while Bun consumers keep the native source export.
v0.1.3July 23, 2026
  • Package metadata now follows the shared compatible 0.1.x dependency range used by this coordinated Tekir release.
v0.1.2July 16, 2026
  • Loki Basic authentication now supports Unicode credentials without failing during header encoding.
v0.1.1June 13, 2026
  • The Loki host is now validated to close an SSRF surface. Only http/https is allowed, and loopback, private, link-local, and cloud-metadata hosts are rejected by default. Set allowInsecureHost: true to opt into local/dev targets. Behavior change: localhost now requires allowInsecureHost.
  • When auth is configured, an http:// target is rejected without allowInsecureHost so credentials are not sent in plaintext.
  • Added a maxBufferSize (default 10000, drop-oldest with a counter) and res.ok checking, so a stalled endpoint cannot grow the buffer without bound and failed deliveries surface via an error counter and optional onError(err). The flush timer is unref'd.
  • Found and fixed with Fable.
v0.1.0April 1, 2026
  • Initial release

Other Utilities packages