UNPKG

@gobstones/gobstones-scripts

Version:

Scripts to abstract away build configuration of Gobstones Project's libraries and modules.

100 lines 3.06 kB
/** * The different available log levels. */ export declare enum LogLevel { Error = "error", Warn = "warn", Info = "info", Debug = "debug" } /** * This class provides a centralize way to report messages in the terminal through * the application, including messages that are always printed, debug information, * error messages and others. */ export declare class Logger { level: LogLevel; /** Whether this logger is turned on */ private _on; /** Create a new logger */ constructor(level: LogLevel); /** * Turn this logger on. If already on, nothing happens. * * @returns the receiver logger. */ on(): this; /** * Turn this logger off. If already off, nothing happens. * * @returns the receiver logger. */ off(): this; /** * Log a message as an error, if the level allows it and the logger is on. * * @param msg - The message to print. * @param style - A style on which to print the message * * @returns the receiver logger. */ error(msg: string, style?: string): this; /** * Log a message as an warning, if the level allows it and the logger is on. * * @param msg - The message to print. * @param style - A style on which to print the message * * @returns the receiver logger. */ warn(msg: string, style?: string): this; /** * Log a message as information, if the level allows it and the logger is on. * * @param msg - The message to print. * @param style - A style on which to print the message * * @returns the receiver logger. */ info(msg: string, style?: string): this; /** * Log a message as debug information, if the level allows it and the logger is on. * * @param msg - The message to print. * @param style - A style on which to print the message * * @returns the receiver logger. */ debug(msg: string, style?: string): this; /** * Log a message regardless of the active level, but only if the logger is on. * * @param msg - The message to print. * @param style - A style on which to print the message * * @returns the receiver logger. */ log(msg: string, style?: string): this; /** * Print the given message in the terminal, if the log level allows it and the logger is on. * * @param msg - The message to print * @param style - The style to use for printing. * @param actualLevel - The actual level on which the message should be printed. */ private print; /** * Answers if the first level is greater or equal than the second one. * * @param level1 - The first level to compare * @param level2 - The second level to compare. * * @returns `true` if the first level is greater or equal than the second, `false` otherwise. */ private isLevelGeqThan; } /** * The default {@link Logger}. */ export declare const logger: Logger; //# sourceMappingURL=Logger.d.ts.map