syntropylog
Version:
An instance manager with observability for Node.js applications
48 lines (47 loc) • 1.5 kB
TypeScript
/**
* MockSyntropyLog - Framework Agnostic Mock
*
* This mock provides a testing-agnostic version of SyntropyLog
* that can be used with both Vitest and Jest without conflicts.
*/
export interface IMockLogger {
info: (...args: any[]) => void;
error: (...args: any[]) => void;
warn: (...args: any[]) => void;
debug: (...args: any[]) => void;
trace: (...args: any[]) => void;
}
export interface IMockContextManager {
getCorrelationId: () => string;
getTransactionId: () => string;
getCorrelationIdHeaderName: () => string;
setCorrelationId: (id: string) => void;
setTransactionId: (id: string) => void;
set: (key: string, value: any) => void;
clear: () => void;
run: <T>(fn: () => Promise<T> | T) => Promise<T>;
}
export interface IMockSyntropyLog {
getLogger: (name?: string) => IMockLogger;
getContextManager: () => IMockContextManager;
init: (config?: any) => Promise<void>;
shutdown: () => Promise<void>;
reset: () => void;
}
export declare class MockSyntropyLog implements IMockSyntropyLog {
private logger;
private contextManager;
constructor();
getLogger(name?: string): IMockLogger;
getContextManager(): IMockContextManager;
init(config?: any): Promise<void>;
shutdown(): Promise<void>;
reset(): void;
}
/**
* Creates a test helper that works with any testing framework
*/
export declare function createTestHelper(): {
mockSyntropyLog: MockSyntropyLog;
beforeEach: () => void;
};