@twilio/flex-ui
Version:
Twilio Flex UI
53 lines (52 loc) • 1.66 kB
TypeScript
import { LogEntry } from "../spies";
import { StringFormatterConfig } from "./stringFormatter";
/**
* @enum {"String"} PredefinedFormatters
* Predefined formatters available for use in custom log managers:
* @property {"String"} String - a formatter that converts provided log entries to a single string
* @memberof Log
*/
export declare enum PredefinedFormatters {
String = "String"
}
/**
* @typedef {object} FormatterTypeOptions
* @property {PredefinedFormatters} type a type of a predefined formatter
* @memberof Log
*/
type FormatterTypeOptions = {
type: PredefinedFormatters;
} & StringFormatterConfig;
/**
* A formatter converts stored logs into data that can be consumed by transports.
* @typedef {function} Formatter
* @param {Array<Log.LogEntry>} data log entries that will be formatted
* @returns {any}
* @memberof Log
* @private
*/
export type Formatter<T> = (data: Array<LogEntry>) => T;
/**
* Create a custom formatter
* @callback CreateFormatter
* @returns {Log.Formatter}
* @memberof Log
* @private
*/
export type CreateFormatter = () => Formatter<any>;
/**
* @typedef FormatterConfigurableOptions
* @mixes Log.FormatterTypeOptions
* @memberof Log
*/
type FormatterConfigurableOptions = FormatterTypeOptions;
/**
* A way to define a formatter for a log manager
*
* @typedef {CreateFormatter | FormatterConfigurableOptions} FormatterConfig
* @memberof Log
*/
export type FormatterConfig = CreateFormatter | FormatterConfigurableOptions;
type getFormatterParams = FormatterTypeOptions;
export declare const getFormatter: ({ type, maxLineLength }: getFormatterParams) => Formatter<any> | undefined;
export {};