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 { Maskea, logging } from "@nopeatech/maskea";
import OpenAI from "openai";
const openai = new OpenAI();
const maskea = new Maskea().use(
logging({ format: "json" })
);
const chat = maskea.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 @nopeatech/maskea API. Full docs at nopea.tech/maskea/docs.