UNPKG

@push.rocks/smartlog

Version:

A minimalistic, distributed, and extensible logging tool supporting centralized log management.

138 lines (137 loc) 3.29 kB
declare const spinnerFrames: { dots: string[]; line: string[]; star: string[]; simple: string[]; }; declare const colors: { black: string; red: string; green: string; yellow: string; blue: string; magenta: string; cyan: string; white: string; gray: string; reset: string; }; /** * A class for creating interactive spinners * Automatically handles non-interactive environments */ export declare class SmartlogSourceInteractive { private textContent; private currentFrame; private interval; private started; private spinnerStyle; private color; private frames; private frameInterval; private interactive; constructor(); /** * Sets the text for the spinner and starts it if not already started */ text(textArg: string): void; /** * Starts the spinner animation */ private start; /** * Renders the current frame of the spinner */ private renderFrame; /** * Stops the spinner */ stop(): void; /** * Marks the spinner as successful and optionally displays a success message */ finishSuccess(textArg?: string): void; /** * Marks the spinner as failed and optionally displays a failure message */ finishFail(textArg?: string): void; /** * Marks the current spinner as successful and starts a new one */ successAndNext(textArg: string): void; /** * Marks the current spinner as failed and starts a new one */ failAndNext(textArg: string): void; /** * Sets the spinner style */ setSpinnerStyle(style: keyof typeof spinnerFrames): this; /** * Sets the spinner color */ setColor(colorName: keyof typeof colors): this; /** * Sets the animation speed in milliseconds */ setSpeed(ms: number): this; /** * Gets the current started state */ isStarted(): boolean; } export interface IProgressBarOptions { total: number; width?: number; complete?: string; incomplete?: string; renderThrottle?: number; clear?: boolean; showEta?: boolean; showPercent?: boolean; showCount?: boolean; } export declare class SmartlogProgressBar { private total; private current; private width; private completeChar; private incomplete; private renderThrottle; private clear; private showEta; private showPercent; private showCount; private color; private startTime; private lastRenderTime; private interactive; private lastLoggedPercent; private logThreshold; constructor(options: IProgressBarOptions); /** * Update the progress bar to a specific value */ update(value: number): this; /** * Increment the progress bar by a value */ increment(value?: number): this; /** * Mark the progress bar as complete */ complete(): this; /** * Set the color of the progress bar */ setColor(colorName: keyof typeof colors): this; /** * Render the progress bar */ private render; } export declare class SmartlogSourceOra extends SmartlogSourceInteractive { get oraInstance(): any; set oraInstance(value: any); } export {};