DevLogBus

Node And TypeScript SDK

The Node SDK lives in:

sdk/node

It publishes to the DevLogBus HTTP API and has no runtime dependencies, so Node and TypeScript app records can appear beside backend, CLI, browser, journal, HTTP, and other SDK records. The default endpoint is:

http://127.0.0.1:7423

Install from npm:

npm install @dan-sherwin/devlogbus

Install from a checkout or release source archive when developing the SDK itself:

npm install /path/to/DevLogBus/sdk/node

Client

import { DevLogBusClient } from "@dan-sherwin/devlogbus";

const devlog = new DevLogBusClient({
  source: "checkout_api",
});

await devlog.publish({
  level: "INFO",
  message: "checkout started",
  attrs: { requestId: "req-1" },
});

Pass endpoint explicitly for a different local or trusted-network daemon:

const devlog = new DevLogBusClient({
  endpoint: "http://devbox:7423",
  source: "checkout_api",
});

Logger Helper

const logger = devlog.logger();

await logger.warn("payment provider slow", {
  provider: "demo",
  elapsedMs: 812,
});

Filters And Redaction

Filters drop records before publishing. Redactors return the record shape that will be sent to the daemon.

import { DevLogBusClient, dropSources, redactAttrs } from "@dan-sherwin/devlogbus";

const devlog = new DevLogBusClient({
  source: "checkout_api",
  filter: dropSources(["noisy_worker"]),
  redactor: redactAttrs(["authorization", "token", "request.apiKey"]),
});

redactAttrs matches either an attribute key or dotted nested path and replaces matching values with [REDACTED].

Local Test

From the repository root:

npm --prefix sdk/node test