The following documentation is just relevant for dash4 plugin development. For informations on how to use Dash4 please read this: Dash4 documentation
Table of Contents
npm i -D @dash4/log
import { log, info, success, error, warn, spinner } from '@dash4/log';
log('terminal', 'place text here');
info('readme', 'place text here');
success('npm-scripts', 'place text here');
error('dependencies', 'place text here');
warn('ui', 'place text here');
const spin = spinner('terminal', 'load config');
spin.start();
await wait(1000);
spin.type('warn');
spin.text('needs longer than usual');
await wait(1000);
spin.succeed('config loaded');
types
type TPackageName = 'server' | 'terminal-emulator' | 'cli' | string;
type TMessage = string | number | object | any[];
type TType = 'log' | 'info' | 'success' | 'error' | 'warn';
export const log = (packageName: TPackageName, message: TMessage) => void;
export const info = (packageName: TPackageName, message: TMessage) => void;
export const success = (packageName: TPackageName, message: TMessage) => void;
export const error = (packageName: TPackageName, message: TMessage) => void;
export const warn = (packageName: TPackageName, message: TMessage) => void;
export function spinner(packageName: TPackageName, message: TMessage, type?: TType): {
start(): void;
succeed(_message: string): void;
fail(_message: string): void;
warn(_message: string): void;
info(_message: string): void;
text(_message: string): void;
type(_message: string): void;
stop(): void;
stopAndPersist(): void;
clear: (): void;
isSpinning: boolean;
indent: number;
}
import { log, info, success, error, warn } from '@dash4/log/build/browser';
log('terminal', 'place some text here');
info('readme', 'place some text here');
success('npm-scripts', 'place some text here');
error('dependencies', 'place some text here');
warn('ui', 'place some text here');
types
export type TPackageName = 'client' | 'react-xterm' | 'ui' | string;
export type TMessage = string | number | object | any[];
export const log = (packageName: TPackageName, message: TMessage, ...args: TMessage[]) => void;
export const info = (packageName: TPackageName, message: TMessage, ...args: TMessage[]) => void;
export const success = (packageName: TPackageName, message: TMessage, ...args: TMessage[]) => void;
export const error = (packageName: TPackageName, message: TMessage, ...args: TMessage[]) => void;
export const warn = (packageName: TPackageName, message: TMessage, ...args: TMessage[]) => void;
License
The @dash4/log is MIT licensed