import { LoggingsLevel, LoggingsMessage } from "../types.ts"; import { LoggingsCORE } from "./core.ts"; /** * Interface representing the data for logging plugins. * * @template Defaults - Type of the plugin's default values. */ export interface LoggingsPluginData { /** Unique identification of the plugin. */ identify: string; /** Default values for the plugin. */ defaults: Defaults; /** * Function called when a message is received. * * @param {LoggingsPluginOnMessage} configs - Plugin configurations. * @param {LoggingsMessage[]} args - List of log messages. * @returns {unknown} - The result of the function execution. */ onMessage?(configs: Defaults, level: LoggingsLevel, args: LoggingsMessage[]): unknown; /** * Function called when creating an instance of the plugin. * * @template InstanceConfigs - Type of the instance's configurations. * @param {LoggingsCORE} instance - The core instance created. * @returns {unknown} - The result of the function execution. */ onCreateInstance? ? InstanceConfigs : LoggingsPluginData>(instance: LoggingsCORE): unknown; /** * Function called when adding a plugin. * * @param {LoggingsPluginData} plugin - The plugin to be added. * @returns {unknown} - The result of the function execution. */ onAddPlugin?(plugin: LoggingsPluginData): unknown; /** * Function called when removing a plugin. * * @param {LoggingsPluginData} plugin - The plugin to be removed. * @returns {unknown} - The result of the function execution. */ onRemPlugin?(plugin: LoggingsPluginData): unknown; } /** * Creates a new logging plugin. * * @template Defaults - Type of the plugin's default values. * @param {LoggingsPluginData} opts - Plugin options. * @returns {object} - The created plugin. */ export declare function LoggingsPlugin(opts: LoggingsPluginData): { identify: string; defaults: {}; onMessage: (configs: Defaults, level: LoggingsLevel, args: LoggingsMessage[]) => unknown; onCreateInstance: ? InstanceConfigs : LoggingsPluginData>(instance: LoggingsCORE) => unknown; onAddPlugin: (plugin: LoggingsPluginData) => unknown; onRemPlugin: (plugin: LoggingsPluginData) => unknown; }; /** * Type representing the return value of the LoggingsPlugin function. * * @type {LoggingsPluginLoader} */ export type LoggingsPluginLoader = Required>;