@plugjs/plug
Version:
PlugJS Build System ===================
84 lines (83 loc) • 3.12 kB
TypeScript
import { EventEmitter } from 'node:events';
import type { Writable } from 'node:stream';
import type { InspectOptions } from 'node:util';
import type { LogLevel } from './levels';
/** Options for our {@link Logger} instances */
export interface LogOptions {
/** The current output. */
output: Writable;
/** The current level for logging. */
level: LogLevel;
/** Whether to log in colors or not. */
colors: boolean;
/** The format of the log to use: `plain` or `fancy`. */
format: 'plain' | 'fancy';
/** Whether to enable the tasks spinner or not. */
spinner: boolean;
/** Width of the current terminal (if any) or `80`. */
lineLength: number;
/** The maximum length of a task name (for pretty alignment). */
taskLength: number;
/** The number of spaces used for indenting. */
indentSize: number;
/** Whether to show sources in reports or not. */
showSources: boolean;
/** Whether GitHub annotations are enabled or not. */
githubAnnotations: boolean;
/** The options used by NodeJS for object inspection. */
readonly inspectOptions: InspectOptions;
/** Add an event listener for the specified event. */
on(eventName: 'changed', listener: (logOptions: this) => void): this;
/** Add an event listener for the specified event triggering only once. */
once(eventName: 'changed', listener: (logOptions: this) => void): this;
/** Remove an event listener for the specified event. */
off(eventName: 'changed', listener: (logOptions: this) => void): this;
/**
* Return a record of environment variables for forking.
*
* @param taskName The default task name of the forked process
*/
forkEnv(taskName?: string): Record<string, string>;
}
declare class LogOptionsImpl extends EventEmitter implements LogOptions {
private _output;
private _level;
private _colors;
private _format;
private _colorsSet;
private _spinner;
private _lineLength;
private _lineLengthSet;
private _showSources;
private _githubAnnotations;
private _inspectOptions;
private _taskLength;
private _indentSize;
constructor();
private _notifyListeners;
forkEnv(taskName?: string): Record<string, string>;
get output(): Writable;
set output(output: Writable);
get level(): LogLevel;
set level(level: LogLevel);
get colors(): boolean;
set colors(color: boolean);
get format(): 'plain' | 'fancy';
set format(format: 'plain' | 'fancy');
get spinner(): boolean;
set spinner(spinner: boolean);
get lineLength(): number;
set lineLength(lineLength: number);
get taskLength(): number;
set taskLength(taskLength: number);
get indentSize(): number;
set indentSize(indentSize: number);
get showSources(): boolean;
set showSources(showSources: boolean);
get githubAnnotations(): boolean;
set githubAnnotations(githubAnnotations: boolean);
get inspectOptions(): InspectOptions;
}
/** Shared instance of our {@link LogOptions}. */
export declare const logOptions: LogOptionsImpl;
export {};