01 / trace
Trace any function
import { trace } from 'autotel';
export const checkout = trace((ctx) =>
async (req, res) => {
const result = await charge(req.body);
return res.json(result);
},
);
Wrap a handler. Spans, error recording, and request context come automatically.
02 / track
Emit product events
import { track } from 'autotel';
track('order.created', {
userId: req.user.id,
amount: result.total,
currency: 'GBP',
});
Fan out to PostHog, webhooks, or any subscriber. Same call, every backend.
03 / log
One canonical log line
import { getRequestLogger } from 'autotel';
const log = getRequestLogger(ctx);
log.set({ userId, plan, source });
log.emitNow();
Build context across the request, then emit one structured event at the end.