import { type Callable, type ITraceableMapper, type ITraceableTuple, LoggerImpl, LogTrace, type LogTraceSupplier, TraceableImpl, } from "@emprespresso/pengueno"; export class LogTraceable extends TraceableImpl { static from(t: T) { return new LogTraceable(t, LogTrace(LoggerImpl)); } } export class TraceUtil { static withFunctionTrace( f: F, ): ITraceableMapper< T, ITraceableTuple, Trace > { return (t) => [t.item, `[${f.name}]`]; } static withClassTrace( c: C, ): ITraceableMapper< T, ITraceableTuple, Trace > { return (t) => [t.item, `[${c.constructor.name}]`]; } static promiseify( mapper: ITraceableMapper, ): ITraceableMapper, Promise, Trace> { return (traceablePromise) => traceablePromise.flatMapAsync(async (t) => t.move(await t.item).map(mapper) ).item; } }