syntropylog
Version:
An instance manager with observability for Node.js applications
52 lines (51 loc) • 2.34 kB
TypeScript
/**
* @file src/SyntropyLog.ts
* @description The main public-facing singleton class for the SyntropyLog framework.
* This class acts as a Facade, providing a simple and clean API surface
* while delegating all complex lifecycle and orchestration work to the internal
* LifecycleManager.
*/
import { EventEmitter } from 'events';
import { SyntropyLogConfig } from './config';
import { IContextManager } from './context';
import { ILogger } from './logger';
import { InstrumentedHttpClient } from './http/InstrumentedHttpClient';
import { InstrumentedBrokerClient } from './brokers/InstrumentedBrokerClient';
import { SyntropyLogState } from './core/LifecycleManager';
import { LogLevel } from './logger/levels';
import { LoggingMatrix } from './types';
import { IBeaconRedis } from './redis/IBeaconRedis';
/**
* @class SyntropyLog
* @description The main public entry point for the framework. It follows the
* Singleton pattern and acts as an EventEmitter to report on its lifecycle,
* proxying events from its internal LifecycleManager.
*/
export declare class SyntropyLog extends EventEmitter {
private static instance;
private readonly lifecycleManager;
private constructor();
static getInstance(): SyntropyLog;
getState(): SyntropyLogState;
init(config: SyntropyLogConfig): Promise<void>;
shutdown(): Promise<void>;
getLogger(name?: string, bindings?: Record<string, any>): ILogger;
getRedis(name: string): Promise<IBeaconRedis>;
getHttp(name: string): InstrumentedHttpClient;
getBroker(name: string): InstrumentedBrokerClient;
getContextManager(): IContextManager;
getConfig(): SyntropyLogConfig;
getFilteredContext(level: LogLevel): Record<string, unknown>;
/**
* Reconfigures the logging matrix dynamically.
* This method allows changing which context fields are included in logs
* without affecting security configurations like masking or log levels.
* @param matrix The new logging matrix configuration
*/
reconfigureLoggingMatrix(matrix: LoggingMatrix): void;
getMasker(): import(".").MaskingEngine;
getSerializer(): import("./serialization/SerializerRegistry").SerializerRegistry;
_resetForTesting(): void;
}
/** The singleton instance of the SyntropyLog framework. */
export declare const syntropyLog: SyntropyLog;