UNPKG

@rushstack/heft

Version:

Build all your JavaScript projects the same way: A way that works.

73 lines 2.17 kB
import { type ITerminalProvider, type ITerminal } from '@rushstack/terminal'; /** * A logger which is used to emit errors and warnings to the console, as well as to write * to the console. Messaged emitted by the scoped logger are prefixed with the name of the * scoped logger. * * @public */ export interface IScopedLogger { /** * The name of the scoped logger. Logging messages will be prefixed with this name. */ readonly loggerName: string; /** * The terminal used to write messages to the console. */ readonly terminal: ITerminal; /** * Indicates if the logger has emitted any errors. */ readonly hasErrors: boolean; /** * Call this function to emit an error to the heft runtime. */ emitError(error: Error): void; /** * Call this function to emit an warning to the heft runtime. */ emitWarning(warning: Error): void; /** * Reset the errors and warnings for this scoped logger. */ resetErrorsAndWarnings(): void; } export interface IScopedLoggerOptions { loggerName: string; terminalProvider: ITerminalProvider; getShouldPrintStacks: () => boolean; errorHasBeenEmittedCallback: () => void; warningHasBeenEmittedCallback: () => void; } export declare class ScopedLogger implements IScopedLogger { private readonly _options; private _errors; private _warnings; private get _shouldPrintStacks(); get errors(): ReadonlyArray<Error>; get warnings(): ReadonlyArray<Error>; readonly loggerName: string; readonly terminalProvider: ITerminalProvider; readonly terminal: ITerminal; /** * @internal */ constructor(options: IScopedLoggerOptions); /** * {@inheritdoc IScopedLogger.hasErrors} */ get hasErrors(): boolean; /** * {@inheritdoc IScopedLogger.emitError} */ emitError(error: Error): void; /** * {@inheritdoc IScopedLogger.emitWarning} */ emitWarning(warning: Error): void; /** * {@inheritdoc IScopedLogger.resetErrorsAndWarnings} */ resetErrorsAndWarnings(): void; } //# sourceMappingURL=ScopedLogger.d.ts.map