@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
74 lines (73 loc) • 2.56 kB
TypeScript
/**
* Logger - Implementation of ILogger for CLI output
*
* Provides:
* - ConsoleLogger: Standard console output with ANSI colors
* - SilentLogger: No output (for testing)
*
* Colors match the existing MCT CLI styling.
*/
import { ILogger } from "./ICommandContext";
/**
* ConsoleLogger outputs to console with ANSI colors.
*/
export declare class ConsoleLogger implements ILogger {
private verboseEnabled;
private quietEnabled;
private debugEnabled;
private jsonMode;
constructor(verbose?: boolean, quiet?: boolean, debug?: boolean, jsonMode?: boolean);
info(message: string): void;
warn(message: string): void;
error(message: string): void;
verbose(message: string): void;
debug(message: string): void;
success(message: string): void;
data(message: string): void;
progress(current: number, total: number, message?: string): void;
private createProgressBar;
}
/**
* SilentLogger produces no output.
* Useful for testing or when output should be suppressed.
*/
export declare class SilentLogger implements ILogger {
info(_message: string): void;
warn(_message: string): void;
error(_message: string): void;
verbose(_message: string): void;
debug(_message: string): void;
success(_message: string): void;
data(_message: string): void;
progress(_current: number, _total: number, _message?: string): void;
}
/**
* BufferedLogger stores all log messages for later retrieval.
* Useful for testing or capturing output.
*/
export declare class BufferedLogger implements ILogger {
readonly messages: Array<{
level: string;
message: string;
}>;
info(message: string): void;
warn(message: string): void;
error(message: string): void;
verbose(message: string): void;
debug(message: string): void;
success(message: string): void;
data(message: string): void;
progress(current: number, total: number, message?: string): void;
clear(): void;
getErrors(): string[];
getWarnings(): string[];
}
/**
* Create a logger based on options.
* @param verbose Enable verbose output
* @param quiet Suppress non-essential output (errors and warnings still shown)
* @param debug Enable debug output
* @param silent Completely suppress all output (for testing)
* @param jsonMode When true, route all non-data output to stderr so stdout contains only machine-readable JSON
*/
export declare function createLogger(verbose?: boolean, quiet?: boolean, debug?: boolean, silent?: boolean, jsonMode?: boolean): ILogger;