igir
Version:
🕹 A zero-setup ROM collection manager that sorts, filters, extracts or archives, patches, and reports on collections of any size on any OS.
50 lines (49 loc) • 1.61 kB
TypeScript
import { LogLevelValue } from './logLevel.js';
import ProgressBar from './progressBar.js';
/**
* {@link Logger} is a class that deals with the formatting and outputting log messages to a stream.
*/
export default class Logger {
private logLevel;
private readonly stream;
private readonly loggerPrefix?;
constructor(logLevel?: LogLevelValue, stream?: NodeJS.WritableStream, loggerPrefix?: string);
getLogLevel(): LogLevelValue;
setLogLevel(logLevel: LogLevelValue): void;
getStream(): NodeJS.WritableStream;
/**
* Determine if this {@link Logger}'s underlying stream is a TTY stream or not.
*/
isTTY(): boolean;
private readonly print;
/**
* Print a newline.
*/
newLine(): void;
/**
* Format a log message for a given {@link LogLevelValue}.
*/
formatMessage(logLevel: LogLevelValue, message: string): string;
trace: (message?: unknown) => void;
debug: (message?: unknown) => void;
info: (message?: unknown) => void;
warn: (message?: unknown) => void;
error: (message?: unknown) => void;
notice: (message?: unknown) => void;
/**
* Print the CLI header.
*/
printHeader(): void;
/**
* Print a colorized yargs help string.
*/
colorizeYargs(help: string): void;
/**
* Create a {@link ProgressBar} with a reference to this {@link Logger}.
*/
addProgressBar(name: string, symbol?: string, initialTotal?: number): ProgressBar;
/**
* Return a copy of this Logger with a new string prefix.
*/
withLoggerPrefix(prefix: string): Logger;
}