UNPKG

declapract

Version:

A tool to declaratively define best practices, maintainable evolve them, and scalably enforce them.

21 lines (20 loc) 614 B
/** * a wrapper which reports how long it took to execute a function, after the function completes * * for example: * ```ts * const doSomethingThatMayTakeAWhile = withDurationReporting( * 'doSomethingThatMayTakeAWhile', * async (someArg: string, anotherArg: number) => { * // your logic here * } * ) * ``` */ export declare const withDurationReporting: <R extends unknown, T extends (...args: any[]) => Promise<R>>(title: string, logic: T, options?: { reportingThresholdSeconds: number; log: (args: { title: string; durationInSeconds: number; }) => void; }) => T;