UNPKG

cross-log

Version:

A universal logging package that works in both browser and Node.js environments with environment variable configuration

28 lines 1.39 kB
/** * Builder pattern implementation for creating loggers with type-safe plugin support */ import { ILogger, PartialLoggerConfig } from '../core/types'; import { PluginName, LoggerWithPlugins, LoggerBuilder, PluginMethods, LoggerWithPluginsConfig, ConfiguredLogger } from './plugin-types'; /** * Create a new logger builder with optional configuration */ export declare function createLoggerBuilder(config?: PartialLoggerConfig): LoggerBuilder; /** * Create a logger with plugins using a configuration object * Provides full type safety for all configured plugins */ export declare function createLoggerWithPlugins<T extends LoggerWithPluginsConfig>(loggerConfig?: PartialLoggerConfig, pluginConfigs?: T): ConfiguredLogger<T>; /** * Type-safe wrapper for existing logger instance * Adds type information for already loaded plugins */ export declare function wrapLogger<P extends PluginName[]>(logger: ILogger, _pluginNames: P): LoggerWithPlugins<P>; /** * Type guard to check if logger has a specific plugin */ export declare function hasPlugin<T extends PluginName>(logger: ILogger, pluginName: T): logger is ILogger & Record<T, PluginMethods<T>>; /** * Type guard to check if logger has multiple plugins */ export declare function hasPlugins<P extends PluginName[]>(logger: ILogger, pluginNames: P): logger is LoggerWithPlugins<P>; //# sourceMappingURL=builder.d.ts.map