UNPKG

@creejs/commons-logging

Version:
113 lines (112 loc) 3.64 kB
declare namespace _default { export { currentProvider }; export { currentLevel }; export { type2Provider }; export { type2Factory }; export { addProvider }; export { getProvider }; export { removeProvider }; export { clearProviders }; export { listProviders }; export { addFactory }; export { getFactory }; export { removeFactory }; export { clearFactories }; export { listFactories }; export { clear }; } export default _default; /** * @module LogConfig * @description Provide Impl of Log Configuration * @private */ /** * type name of current provider * @type {string} * @public */ export let currentProvider: string; /** * Global logging level * @type {number} * @public */ export let currentLevel: number; /** * The map of registered logging libraries * @type {Map<string,Provider>} * @private */ export const type2Provider: Map<string, Provider>; /** * Created LogFactories Index with type name * @type {Map<string, LogFactory>} * @public */ export const type2Factory: Map<string, LogFactory>; /** * Adds a logging provider for the specified type. * @param {string} typeName - The type identifier for the provider. * @param {Provider} provider - The logging provider implementation. * @returns {void} * @alias module:LogConfig.addProvider */ export function addProvider(typeName: string, provider: Provider): void; /** * Gets the logging provider for the specified type name. * @param {string} typeName - The type name to look up in the provider map. * @returns {Provider|undefined} The logging provider instance if found, otherwise undefined. */ export function getProvider(typeName: string): Provider | undefined; /** * Removes a logging provider of the specified type. * @param {string} typeName - The type name of the provider to remove. * @returns {boolean} */ export function removeProvider(typeName: string): boolean; export function clearProviders(): void; /** * Returns an array of all registered factory types and intances. * 1. Each entry is a [type, factory] pair * @returns {Array<{0:string, 1:Provider}>} An array of factory entries. */ export function listProviders(): Array<{ 0: string; 1: Provider; }>; /** * Registers a log factory for a given type name. * @param {string} typeName - The name of the log type to register. * @param {LogFactory} logFactory - Factory function that creates a logger for the specified type. */ export function addFactory(typeName: string, logFactory: LogFactory): void; /** * Gets the factory function associated with the given type name. * @param {string} typeName - The name of the type to look up. * @returns {LogFactory|undefined} The factory function for the specified type. */ export function getFactory(typeName: string): LogFactory | undefined; /** * Removes a factory of the given type from the type-to-factory mapping. * @param {string} typeName - The name of the type whose factory should be removed. * @returns {boolean} */ export function removeFactory(typeName: string): boolean; /** * Clears all registered factories from the type2Factory instance. * This is typically used to reset the factory state during testing or teardown. */ export function clearFactories(): void; /** * Returns an array of all registered factory types and intances. * 1. Each entry is a [type, factory] pair * @returns {Array<{0:string, 1:LogFactory}>} An array of factory entries. */ export function listFactories(): Array<{ 0: string; 1: LogFactory; }>; export function clear(): void; import Provider from './provider.js'; import LogFactory from './log-factory.js';