JavaScript SDK (BETA)

Official JavaScript/TypeScript SDK for communicating with the LogFlux agent via Unix socket or TCP

JavaScript Logo Node.js Logo

BETA SOFTWARE: This SDK is feature-complete for basic logging use cases but is marked as BETA while we gather community feedback and add additional features. The API is stable but may evolve based on user needs.

A lightweight JavaScript/TypeScript SDK for communicating with the LogFlux agent’s local server via Unix socket or TCP protocols.

Complete documentation and examples on GitHub →

Key Features

  • Multiple transport protocols: Unix socket (default), TCP
  • Automatic batching: Configurable batch sizes and flush intervals
  • Authentication support: TCP shared secret authentication
  • TypeScript support: Full type definitions included
  • Popular integrations: Winston, Bunyan, Pino, Debug, Log4js, Consola, Loglevel

Built-in Logger Integrations

Integrations and adapters for popular Node.js logging libraries:

  • Winston - Structured logger transport
  • Bunyan - Stream-based logger integration
  • Pino - Ultra-fast JSON logger destination
  • Debug - Debugging utility integration
  • Log4js - Log4j-style logger appender
  • Consola - Universal logger reporter
  • Loglevel - Minimal logger integration

Installation

1
npm install @logflux-io/logflux-js-sdk

Quick Start

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import { 
  createUnixClient, 
  createLogEntry, 
  LogLevel 
} from '@logflux-io/logflux-js-sdk';

// Create client and send log
const client = createUnixClient('/tmp/logflux-agent.sock');
const entry = createLogEntry('Hello, LogFlux!', 'my-app');

await client.connect();
await client.sendLogEntry(entry);
await client.close();

Current Status

  • Stable API for core logging functionality
  • Production quality code and testing
  • Ready for evaluation and non-critical use cases
  • Additional features (metrics, traces, events) coming soon

Requirements

  • Node.js: 16.0.0 or later
  • LogFlux Agent: Required for SDK operation

Support

Disclaimer

The JavaScript and Node.js logos and trademarks are the property of Oracle Corporation and the Node.js Foundation respectively. LogFlux is not affiliated with, endorsed by, or sponsored by Oracle Corporation or the Node.js Foundation. The JavaScript and Node.js logos are used solely for identification purposes to indicate compatibility and integration capabilities.