UNPKG

hagen

Version:

A colorful logger for JS in Node and the Browser

51 lines (47 loc) 1.43 kB
import { ChalkInstance } from 'chalk'; /** * A colorful logger for JS in Node and in the Browser * * Named after Hagen the colorful Lumberjack from Synthie Forest * https://vimeo.com/90995716 */ type Label = string | { label: string; color: ChalkInstance | number; } | { label: string; bgColor: string; fgColor: string; }; interface LoggerConfig { showTimestamp: boolean; colors: { reserved: { WARN: ChalkInstance; ERROR: ChalkInstance; INFO: ChalkInstance; SUCCESS: ChalkInstance; }; normal: ChalkInstance[]; }; fixedWidth?: { width: number; truncationMethod?: "start" | "end" | "middle"; }; } declare function setConfig(config: Partial<LoggerConfig>): void; declare function getConfig(): LoggerConfig; declare function resetConfig(): void; declare function log(label: Label, ...data: any[]): void; declare function info(label: string, ...data: any[]): void; declare function success(label: string, ...data: any[]): void; declare function warn(label: string, ...data: any[]): void; declare function error(label: string, ...data: any[]): void; declare const _default: { log: typeof log; info: typeof info; success: typeof success; warn: typeof warn; error: typeof error; }; export { _default as default, error, getConfig, info, log, resetConfig, setConfig, success, warn };