import { CreateLoggerOptions, LogKind, Logger, LoggerConfig, LoggerPluginMap, LoggerScopeId, NormalizedLoggerConfig } from "./types/index.js"; //#region src/core/config.d.ts /** * Retrieves the raw logger configuration for a specific scope. * * @param scopeId - The identifier for the logger scope * @returns The raw logger configuration if registered for the scope, undefined otherwise */ declare function getScopedLoggerConfig(scopeId: LoggerScopeId): LoggerConfig | undefined; /** * Sets the logger configuration for a specific scope. * * The configuration will be normalized and compiled for runtime use. This method * is particularly useful for applying scope-specific logging rules that differ * from the default logger configuration. * * @param scopeId - The identifier for the logger scope * @param config - The logger configuration to apply for this scope * @throws {Error} If the logger is controlled by the vite plugin and config cannot be modified directly */ declare function setScopedLoggerConfig(scopeId: LoggerScopeId, config: LoggerConfig): void; /** * Resets the logger configuration for a specific scope to its initial state. * * After calling this function, the scope will use the default configuration * until a new configuration is applied via setScopedLoggerConfig(). * * @param scopeId - The identifier for the logger scope to reset */ declare function resetScopedLoggerConfig(scopeId: LoggerScopeId): void; /** * Updates the logger configuration for the default logger scope. * * This function is primarily intended for direct logger usage outside any runtime * with an injected logger scope (such as createDocsIslands()). It provides a simple * way to configure logging behavior for the application's default scope. * * When the logger is controlled by the vite plugin configuration, this method * cannot be used; instead, update the loggerPlugin.vite({ config }) option * in your bundler configuration. * * @param config - The logger configuration to apply globally * @throws {Error} If the logger is controlled by the vite plugin and config cannot be modified directly * * @example * ```ts * setLoggerConfig({ * levels: ['error', 'warn'], * rules: { * 'build-info': { group: 'build', levels: ['info'] }, * }, * }); * ``` */ declare function setLoggerConfig(config: LoggerConfig): void; /** * Resets the logger configuration for the default logger scope to its initial state. * * After calling this function, the default scope will revert to the built-in * default configuration until a new configuration is applied via setLoggerConfig(). * * This function cannot be used when the logger is controlled by the vite plugin. * * @throws {Error} If the logger is controlled by the vite plugin and config cannot be modified directly */ declare function resetLoggerConfig(): void; /** * Determines whether a log message should be suppressed based on the current configuration. * * This function evaluates the log kind (info, warn, error, success, debug) against * the configured visibility levels and matching rules to determine if the message * should be output or filtered out. * * @param kind - The type of log message (info, warn, error, success, or debug) * @param options - The log context including group, main module name, and optional message pattern * @param scopeId - Optional logger scope identifier; uses default scope if not provided * @returns true if the log should be suppressed (not output), false if it should be shown * * @example * ```ts * // Suppress logs for a specific group * const suppress = shouldSuppressLog('info', { * group: 'vitepress', * main: 'build', * message: 'Starting build', * }); * ``` */ declare function shouldSuppressLog(kind: LogKind, options: { group: string; main: string; message?: string; }, scopeId?: LoggerScopeId): boolean; /** * Resolves a logger configuration object into the runtime matching shape. * * This function processes user-provided logger configuration by: * - Normalizing plugin definitions and merging plugin-based rule presets * - Expanding rule references to their full definitions * - Validating rule labels for uniqueness * - Normalizing log levels to a consistent format * - Creating matcher functions for group and message rules * * The resolved configuration is ready for runtime rule matching. * * @param config - The logger configuration object containing plugins, rules, levels, and debug settings * @returns A normalized and validated logger configuration ready for runtime use * * @example * ```ts * const resolved = resolveLoggerConfig({ * levels: ['error', 'warn'], * rules: { * 'my-rule': { message: '*.test', levels: ['error'] }, * }, * }); * ``` */ declare function resolveLoggerConfig(config: LoggerConfig): NormalizedLoggerConfig; //#endregion //#region src/core/factory.d.ts /** * Creates a logger instance for a specific scope with a given main module identifier. * * This function returns a Logger instance that can create scoped loggers by group, * filtered according to the configuration registered for the given scope. If no * configuration exists for the scope, an error is thrown. * * @param options - Logger creation options containing the main module name * @param scopeId - The identifier for the logger scope; determines which configuration is used * @returns A logger instance for the specified scope * @throws {Error} If no logger configuration is registered for the provided scope ID * * @example * ```ts * // Create a logger for a custom scope * const customLogger = createScopedLogger({ main: 'analyzer' }, 'custom-scope'); * const groupLogger = customLogger.getLoggerByGroup('vitepress'); * groupLogger.info('Message'); * ``` */ declare const createScopedLogger: (options: CreateLoggerOptions, scopeId: LoggerScopeId) => Logger; /** * Creates a logger instance using the default logger scope. * * This is a convenience wrapper around createScopedLogger() that automatically * uses the default scope. Use this for general-purpose logging in applications * that don't require multiple logger scopes. * * @param options - Logger creation options containing the main module name * @returns A logger instance for the default scope * * @example * ```ts * const logger = createLogger({ main: 'app' }); * const groupLogger = logger.getLoggerByGroup('startup'); * groupLogger.info('Application initialized'); * ``` */ declare function createLogger(options: CreateLoggerOptions): Logger; //#endregion export { resetScopedLoggerConfig as a, setScopedLoggerConfig as c, resetLoggerConfig as i, shouldSuppressLog as l, createScopedLogger as n, resolveLoggerConfig as o, getScopedLoggerConfig as r, setLoggerConfig as s, createLogger as t };