import { DefaultLogLevels } from "./LogUtils"; type Logger = { debug: (...args: any[]) => void; warn: (...args: any[]) => void; }; type Detail = { message?: string; [key: string]: unknown; }; export type PerformanceData = { task: string; duration: number; message: string; at: string; data?: Record; }; type ProfilerOptions = { logger: Logger; at: string; logLevel?: DefaultLogLevels; } & Record; export declare class Profiler { private marks; private at; private detail; private logger; /** * Initializes a new instance of the Profiler class. * @param logger The logger instance for logging performance data. * @param at A string identifier for where the profiler is used. * @param detail Optional additional detail data. */ constructor({ logger, at, logLevel, ...detail }: ProfilerOptions); warn(data: Parameters[0]): void; logMeasure(data: Omit): void; /** * Starts a profiling session for a task. * @param task The name of the task being measured. * @param detail Optional detail data to merge. * @returns An object containing the start time and a stop function. */ start(task: string, detail?: Detail): { startTime: number; stop: (_detail?: Detail) => number | undefined; }; /** * Records a mark with a label and optional detail. * @param label The label for the mark. * @param detail Optional detail data to merge. * @returns The current timestamp in milliseconds. */ mark(label: string, detail?: Detail): number; /** * Measures the duration between two marks and logs the performance data. * @param task The name of the task for this measurement. * @param params An object containing: * - `from`: The label of the starting mark. * - `to` (optional): The label of the ending mark. * - Additional detail data to merge. * @returns The duration in milliseconds, or undefined if the start mark is not found. */ measure(task: string, params: { from: string; to?: string; } & Detail): number | undefined; /** * Measures the performance of an asynchronous operation represented by a promise. * @param pr The promise representing the asynchronous operation to measure. * @param task The name of the task for this measurement. * @param detail Optional detail data to merge. * @returns A promise that resolves with the result of the asynchronous operation. */ measureAsync(pr: Promise, task: string, detail?: Detail): Promise; /** * Measures the performance of a synchronous function by wrapping it. * @param fn The synchronous function to measure. * @param task The name of the task for this measurement. * @param detail Optional detail data to merge. * @returns The result of the synchronous function. */ measureSync(fn: () => T, task: string, detail?: Detail): T; } export {}; //# sourceMappingURL=Profiler.d.ts.map