import * as clc from 'cli-color'; import { LogEntry, Transformer } from './AnsiLogger'; /** * All the colors available to configure. * * - ERROR - The color of the `error` output. * - WARN - The color of the `warn` output, * - SUCCESS - The color of the `success` output. * - LOG - The color of the `default` log output. * - INFO - The color of the `info` log output. * - DEBUG - The color of the `debug` log output. * - VERBOSE - The color of the `verbose` log output. * - GROUP - The color of the `group section` of the output. * - TIME - The color of the `time section` of the output. */ export declare type ColorType = 'ERROR' | 'WARN' | 'SUCCESS' | 'LOG' | 'INFO' | 'DEBUG' | 'VERBOSE' | 'GROUP' | 'TIME'; /** * The map from `ColorType`s to a coloring functions. */ export declare type ColorMap = { [P in ColorType]: clc.Format; }; /** * Options interface for text transformer. */ export interface TextTransformerOptions { /** * The map of which coloring functions to use when/where. */ colorMap?: Partial; /** * Whether or not if colors is enabled, default: `process.stdout.isTTY`. */ colors?: boolean; /** * Always output colors, no matter if stdout is a TTY. */ forceColors?: boolean; /** * The printer. */ printer?: { err: (msg: string) => void; out: (msg: string) => void; }; } /** * Interface for the internal text transformer options. */ export interface TextTransformerOptionsInternal { /** * Whether or not if colors is enabled, default: `process.stdout.isTTY`. */ colors: boolean; /** * Always output colors, no matter if stdout is a TTY. */ forceColors: boolean; } /** * Transformer from log entries to human readable colorized text. */ export declare class TextTransformer implements Transformer { /** * Whether or not this transformer outputs colored text. */ readonly useColors: boolean; /** * Default color scheme * can be overriden by providing a * new full or partial ColorMap. */ readonly colors: ColorMap; readonly options: Readonly; readonly printer: { readonly err: (msg: string) => void; readonly out: (msg: string) => void; }; constructor(options?: TextTransformerOptions); /** * Colorize the message string. * NB! If no-colors mode is on or no color is given. * then this method just return the message as it is. */ private colorize; /** * Format group if any. */ private formatGroup; /** * Format the log mask to the console. */ private formatLogLevel; /** * Format a object to string. */ private formatTime; private formatTypesInternal; /** * Prefix eact line of msg with prefix. */ private handleMultiline; /** * Resolve which coloring function to use for the level mask. */ private resolveLevelColor; /** * Setting a single color in the `ColorMap`. */ private setColor; /** * Set new colors. */ private setColors; /** * Transform log entry to text output. */ format(entry: LogEntry): string; /** * Format complex types. */ formatTypes(inputType: T): string; }