Skip to content

About

Official Node.js SDK for ZinaLog, send structured logs, errors, and application events to your self-hosted ZinaLog instance.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

Repository files navigation

Node.js SDK for Zinalog — send logs from your Node.js app to your Zinalog instance.

Installation

npm install @zinalog/node

Usage

import { ZinaLog } from "@zinalog/node";

const log = new ZinaLog({
  apiKey: "ZINA_LOG_API_KEY",
  endpoint: "https://your-zinalog-instance.com",
  service: "my-app",
});

log.info("Server started");
log.warn("High memory usage", { metadata: { mem: "85%" } });
log.error("Request failed", { stack: err.stack, metadata: { userId: 42 } });
log.debug("Query executed", { metadata: { duration_ms: 12 } });
log.error("Grouped payment failure", {
  service: "billing-worker",
  fingerprint: "payment-declined",
});

Options

Option Type Required Description
apiKey string ✅ Your Zinalog API key
endpoint string ✅ Base URL of your Zinalog instance
service string — Default service name attached to every log
batchSize number — Flush immediately when queue hits this size (default: 50)
flushIntervalMs number — How often the queue is flushed in ms (default: 100)

Log methods

Method Level sent
log.info(msg, opts?) info
log.warn(msg, opts?) warning
log.error(msg, opts?) error
log.debug(msg, opts?) debug

Each method accepts an optional second argument { metadata, service, stack, fingerprint }. The fingerprint field is an optional grouping hint accepted by ZinaLog core.

Manual flush

Logs are flushed automatically on an interval. Call flush() explicitly before process exit if needed:

await log.flush();

Requirements

Node.js ≥ 20

About

Official Node.js SDK for ZinaLog, send structured logs, errors, and application events to your self-hosted ZinaLog instance.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages