import type { FormatterFunction } from "@visulima/fmt"; import type { Meta, StringifyAwareProcessor } from "../types.d.ts"; /** * Message Formatter Processor. * * A processor that formats log messages using the {@link https://www.visulima.com/docs/package/fmt|@visulima/fmt} library. * Supports custom formatters, string interpolation, and complex object formatting. * Processes both the main message and contextual data. * @template L - The log level type * @example * ```typescript * import { createPail } from "@visulima/pail"; * import MessageFormatterProcessor from "@visulima/pail/processor/message-formatter"; * * const logger = createPail({ * processors: [new MessageFormatterProcessor({ * formatters: { * user: (value) => `[USER:${value.id}]` * } * })] * }); * * logger.info("User {user} logged in", { user: { id: 123 } }); * // Output: "User [USER:123] logged in" * ``` */ declare class MessageFormatterProcessor implements StringifyAwareProcessor { #private; /** * Creates a new MessageFormatterProcessor instance. * @param options Configuration options * @param options.formatters Custom formatters for message interpolation */ constructor(options?: { formatters?: Record; }); /** * Sets the stringify function for object serialization. * @param function_ The stringify function to use for serializing objects */ setStringify(function_: any): void; /** * Processes log metadata to format messages. * * Applies string interpolation and custom formatters to the message * and contextual data in the log metadata. * @param meta The log metadata to process * @returns The processed metadata with formatted messages */ process(meta: Meta): Meta; } export default MessageFormatterProcessor;