import { getTracerContext } from '../context'; interface LogTracerCreateOptions { description?: string; } export const createLogTracer = (options: LogTracerCreateOptions) => { const { description = 'LogTracer' } = options; const tracer = crypto.randomUUID(); const { command } = getTracerContext(); command({ type: 'LogTracer', tracer: tracer, action: 'create', params: { description: description, }, }); const log = (...args: unknown[]) => { const parsed = args.map((arg) => { if (typeof arg === 'string') { return arg; } return JSON.stringify(arg); }); const message = parsed.join(' '); command({ type: 'LogTracer', tracer: tracer, action: 'log', params: { message: message, }, }); }; return { log, }; };