logs-interceptor
Version:
High-performance, production-ready log interceptor for Node.js applications with Loki integration. Built with Clean Architecture principles. Supports Node.js, Browser, and Node-RED.
109 lines • 3.59 kB
TypeScript
import { LogsInterceptorConfig } from './application';
import { ILogger } from './domain/interfaces/ILogger';
/**
* Initialize the logs interceptor with configuration
* Can be called multiple times - subsequent calls will update the configuration
*/
export declare function init(userConfig?: Partial<LogsInterceptorConfig>): ILogger;
/**
* Get the global logger instance
* Throws an error if not initialized
*/
export declare function getLogger(): ILogger;
/**
* Check if the logger is initialized
*/
export declare function isInitialized(): boolean;
/**
* Destroy the global logger instance
*/
export declare function destroy(): Promise<void>;
export declare const logger: {
/**
* Log a debug message
*/
debug: (message: string, context?: Record<string, unknown>) => void;
/**
* Log an info message
*/
info: (message: string, context?: Record<string, unknown>) => void;
/**
* Log a warning message
*/
warn: (message: string, context?: Record<string, unknown>) => void;
/**
* Log an error message
*/
error: (message: string, context?: Record<string, unknown>) => void;
/**
* Log a fatal message
*/
fatal: (message: string, context?: Record<string, unknown>) => void;
/**
* Track an event
*/
trackEvent: (eventName: string, properties?: Record<string, unknown>) => void;
/**
* Force flush logs
*/
flush: () => Promise<void>;
/**
* Get metrics
*/
getMetrics: () => import("./domain/interfaces/ILogger").LoggerMetrics | undefined;
/**
* Get health status
*/
getHealth: () => import("./domain/interfaces/ILogger").HealthStatus | undefined;
};
declare const _default: {
init: typeof init;
getLogger: typeof getLogger;
isInitialized: typeof isInitialized;
destroy: typeof destroy;
logger: {
/**
* Log a debug message
*/
debug: (message: string, context?: Record<string, unknown> | undefined) => void;
/**
* Log an info message
*/
info: (message: string, context?: Record<string, unknown> | undefined) => void;
/**
* Log a warning message
*/
warn: (message: string, context?: Record<string, unknown> | undefined) => void;
/**
* Log an error message
*/
error: (message: string, context?: Record<string, unknown> | undefined) => void;
/**
* Log a fatal message
*/
fatal: (message: string, context?: Record<string, unknown> | undefined) => void;
/**
* Track an event
*/
trackEvent: (eventName: string, properties?: Record<string, unknown> | undefined) => void;
/**
* Force flush logs
*/
flush: () => Promise<void>;
/**
* Get metrics
*/
getMetrics: () => import("./domain/interfaces/ILogger").LoggerMetrics | undefined;
/**
* Get health status
*/
getHealth: () => import("./domain/interfaces/ILogger").HealthStatus | undefined;
};
};
export default _default;
export type { LogLevel } from './domain/value-objects/LogLevel';
export { LogLevelVO } from './domain/value-objects/LogLevel';
export type { LogEntry, LogMetadata } from './domain/entities/LogEntry';
export type { ILogger, LoggerMetrics, HealthStatus } from './domain/interfaces/ILogger';
export type { LogsInterceptorConfig, ResolvedLogsInterceptorConfig } from './application/config/LogsInterceptorConfig';
//# sourceMappingURL=index.d.ts.map