UNPKG

@bubblewrap/core

Version:

Core Library to generate, build and sign TWA projects

89 lines (88 loc) 3.31 kB
/** * An interface for loggers. */ export interface Log { /** * Prints a debug message to the Log. Message is ignored if the Log is not set to verbose. * @param message the message the be printed. * @param args extra arguments for the console. */ debug(message: string, ...args: string[]): void; /** * Prints an info message to the Log. Message is ignored if the Log is not set to verbose. * @param message The message the be printed. * @param args Extra arguments for the console. */ info(message: string, ...args: string[]): void; /** * Prints an warning message to the Log. Message is ignored if the Log is not set to verbose. * @param message The message the be printed. * @param args Extra arguments for the console. */ warn(message: string, ...args: string[]): void; /** * Prints an error message to the Log. Message is ignored if the Log is not set to verbose. * @param message The message the be printed. * @param args Extra arguments for the console. */ error(message: string, ...args: string[]): void; setVerbose(verbose: boolean): void; } /** * An utility class to print nice Log messages. */ export declare class ConsoleLog implements Log { private tag; private prefix; private output; /** * The verbosity of the Log. "debug" messages are ignored if verbose is set to false. */ verbose: boolean; /** * Creates a new Log instance * @param tag The tag used when logging. Printed at the beggining of a log message. * @param verbose If the Log is verbose. Debug messages are only printed on verbose logs. * @param output Where to output the log messages. */ constructor(tag?: string, verbose?: boolean, output?: Console); /** * Prints a debug message to the Log. Message is ignored if the Log is not set to verbose. * @param message The message the be printed. * @param args Extra arguments for the console. */ debug(message: string, ...args: string[]): void; /** * Prints an info message to the Log. Message is ignored if the Log is not set to verbose. * @param message The message the be printed. * @param args Extra arguments for the console. */ info(message: string, ...args: string[]): void; /** * Prints an warning message to the Log. Message is ignored if the Log is not set to verbose. * @param message The message the be printed. * @param args Extra arguments for the console. */ warn(message: string, ...args: string[]): void; /** * Prints an error message to the Log. Message is ignored if the Log is not set to verbose. * @param message The message the be printed. * @param args Extra arguments for the console. */ error(message: string, ...args: string[]): void; /** * Sets the verbose. * @param verbose The verbose value to set. */ setVerbose(verbose: boolean): void; /** * Creates a new Log using the same output and verbositity of the current Log. * @param newTag The tag the be used on the new Log instance. */ newLog(newTag: string): ConsoleLog; private log; private inverse; private dim; private yellow; private red; }