Logging Execution Duration of Effect Spans in TypeScript

what exactly does withLogSpan do?
like the time that gets logged out what is that measuring? the time from when the span starts to when the log happens?

is there a cleaner way to log the duration of an entire span besides somehting like this?
const logTraceSpan =
  <A, E, R>(name: string) =>
  (effect: Effect.Effect<A, E, R>) =>
    Effect.zipRight(
      Effect.logTrace(`${name} START`),
      effect.pipe(
        Effect.timed,
        Effect.tap(([duration, _value]) =>
          Effect.logTrace(
            `${name} END Duration: ${Duration.toMillis(duration)}ms`,
          ),
        ),
        Effect.map(([_duration, value]) => value),
      ),
    );
Was this page helpful?