MCPcopy Create free account
hub / github.com/GCWing/BitFun / measureAsyncAndLog

Function measureAsyncAndLog

src/web-ui/src/shared/utils/timing.ts:92–101  ·  view source on GitHub ↗
(
  logger: LoggerLike,
  message: string,
  task: () => Promise<T> | T,
  options: TimedLogOptions = {}
)

Source from the content-addressed store, hash-verified

90}
91
92export async function measureAsyncAndLog<T>(
93 logger: LoggerLike,
94 message: string,
95 task: () => Promise<T> | T,
96 options: TimedLogOptions = {}
97): Promise<MeasuredValue<T>> {
98 const result = await measureAsync(task);
99 logDuration(logger, message, result.durationMs, options);
100 return result;
101}
102
103/**
104 * Wrap a promise with a timeout that rejects after `ms` milliseconds.

Callers 1

initializeBeforeRenderFunction · 0.90

Calls 2

measureAsyncFunction · 0.85
logDurationFunction · 0.85

Tested by

no test coverage detected