← klaro.services
SentinelConsentraKlaroShieldBundlesPricing
Logging & observability

Ship structured logs to your own observability stack

logging({ format: "json" }) prints one JSON object per call instead of the pretty-printed default -- pipe it straight into your log aggregator.

← All recipes
import { Klaro, logging } from "@klaroshield/sdk";
import OpenAI from "openai";

const openai = new OpenAI();

const klaro = new Klaro().use(
  logging({ format: "json" })
);

const chat = klaro.wrap(
  openai.chat.completions.create.bind(openai.chat.completions)
);

// $ node app.js | your-log-shipper
// {"callId":"...","attempt":1,"durationMs":812,"ok":true,"timestamp":"..."}

Checked against the shipped @klaroshield/sdk API. Full docs at klaro.services/klaroshield/docs.

More in Logging & observability

Silence console output but keep local history