logs-interceptor
Version:
High-performance, production-ready log interceptor for Node.js applications with Loki integration
27 lines • 1.08 kB
TypeScript
import { LogsInterceptorConfig } from './types';
/**
* Safely stringify any value, handling circular references and non-serializable objects
*/
export declare function safeStringify(value: unknown): string;
/**
* Parse labels from environment variable string format
* Format: "key1=value1,key2=value2"
*/
export declare function parseLabels(labelsString: string): Record<string, string>;
/**
* Determine if a log should be sampled based on sampling rate
*/
export declare function shouldSample(rate: number): boolean;
/**
* Load configuration from environment variables
*/
export declare function loadConfigFromEnv(): Partial<LogsInterceptorConfig>;
/**
* Merge configurations with precedence: user config > env config > defaults
*/
export declare function mergeConfigs(userConfig: Partial<LogsInterceptorConfig>, envConfig: Partial<LogsInterceptorConfig>): Partial<LogsInterceptorConfig>;
/**
* Validate that required configuration is present
*/
export declare function validateConfig(config: Partial<LogsInterceptorConfig>): string[];
//# sourceMappingURL=utils.d.ts.map