strogger
Version:
📊 A modern structured logging library with functional programming, duck-typing, and comprehensive third-party integrations
26 lines • 1.14 kB
TypeScript
export interface PerformanceMetrics {
functionName: string;
duration: number;
startTime: number;
endTime: number;
metadata?: Record<string, unknown>;
}
export interface PerformanceMonitorState {
metrics: Map<string, PerformanceMetrics[]>;
}
export declare const createPerformanceMonitor: (initialState?: PerformanceMonitorState) => {
state: PerformanceMonitorState;
startTimer: (functionName: string) => (metadata?: Record<string, unknown>) => PerformanceMetrics;
timeAsync: <T>(functionName: string, fn: () => Promise<T>, metadata?: Record<string, unknown>) => Promise<T>;
timeSync: <T>(functionName: string, fn: () => T, metadata?: Record<string, unknown>) => T;
getMetrics: (functionName?: string) => PerformanceMetrics[];
getAverageDuration: (functionName: string) => number;
getSlowestExecution: (functionName?: string) => PerformanceMetrics | null;
clearMetrics: (functionName?: string) => void;
getMetricsSummary: () => Record<string, {
count: number;
avgDuration: number;
maxDuration: number;
}>;
};
//# sourceMappingURL=performance.d.ts.map