From 3a3fb9c8ab0c798a278f76d40de216fa96f6e2c4 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Wed, 14 May 2025 18:02:34 -0700 Subject: moar --- u/trace/trace.ts | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'u/trace/trace.ts') diff --git a/u/trace/trace.ts b/u/trace/trace.ts index 5d5c59b..1d3d2d8 100644 --- a/u/trace/trace.ts +++ b/u/trace/trace.ts @@ -1,31 +1,43 @@ -import type { Callable } from "@emprespresso/utils"; import { + type Callable, type ITraceableMapper, type ITraceableTuple, + LoggerImpl, + LogTrace, + type LogTraceSupplier, TraceableImpl, - TraceableLogger, -} from "./mod.ts"; +} from "@emprespresso/pengueno"; -export class Traceable extends TraceableImpl { +export class LogTraceable extends TraceableImpl { static from(t: T) { - return new Traceable(t, new TraceableLogger()); + return new LogTraceable(t, LogTrace(LoggerImpl)); } +} - static withFunctionTrace( +export class TraceUtil { + static withFunctionTrace( f: F, - ): ITraceableMapper> { - return (t) => [t.item, f.name]; + ): ITraceableMapper< + T, + ITraceableTuple, + Trace + > { + return (t) => [t.item, `[${f.name}]`]; } - static withClassTrace( + static withClassTrace( c: C, - ): ITraceableMapper> { - return (t) => [t.item, c.constructor.name]; + ): ITraceableMapper< + T, + ITraceableTuple, + Trace + > { + return (t) => [t.item, `[${c.constructor.name}]`]; } - static promiseify( - mapper: ITraceableMapper, - ): ITraceableMapper, TraceableLogger, Promise> { + static promiseify( + mapper: ITraceableMapper, + ): ITraceableMapper, Promise, Trace> { return (traceablePromise) => traceablePromise.flatMapAsync(async (t) => t.move(await t.item).map(mapper) -- cgit v1.2.3-70-g09d2