@augment-vir/common
Version:
A collection of augments, helpers types, functions, and classes for any JavaScript environment.
65 lines (64 loc) • 2.19 kB
TypeScript
/**
* Supported log output types.
*
* @category Log : Util
* @category Package : @augment-vir/common
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
*/
export declare enum LogOutputType {
/** Logged to stdout if the current environment supports it, or just `console.log`. */
Standard = "stdout",
/** Logged to stderr if the current environment supports it, or just `console.error`. */
Error = "stderr"
}
/**
* Standardized color keys for logging. If you want to use customized colors, use
* [ansi-styles](https://www.npmjs.com/package/ansi-styles) in Node.js or [custom
* CSS](https://developer.mozilla.org/docs/Web/API/console#styling_console_output) in browsers.
*
* @category Log : Util
* @category Package : @augment-vir/common
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
*/
export declare enum LogColorKey {
Bold = "bold",
Debug = "debug",
Error = "error",
Faint = "faint",
Info = "info",
Mutate = "mutate",
NormalWeight = "normalWeight",
Plain = "plain",
Reset = "reset",
Success = "success",
Warning = "warning"
}
/**
* Configuration for creating a logger. This is not required, as a default configuration is built-in
* already.
*
* @category Log : Util
* @category Package : @augment-vir/common
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
*/
export type LogColorConfig = Readonly<Record<LogColorKey, {
/** Either an array of CSS property assignments */
colors: string[];
logType: LogOutputType;
}>>;
/**
* Mapping of color keys to the current color string.
*
* @category Log : Util
* @category Package : @augment-vir/common
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
*/
export declare const logColors: Readonly<Record<LogColorKey, string>>;
/**
* Default implementation of {@link LogColorConfig}.
*
* @category Log : Util
* @category Package : @augment-vir/common
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
*/
export declare const defaultLogColorConfig: LogColorConfig;