@tsmodule/log
TypeScript icon, indicating that this package has built-in type declarations

3.0.6 • Public • Published

Console styles

Type-safe wrapper around ansi-styles, similar to chalk. Weighs 4kB.

Example

You can provide a single style as a string, or multiple as an array of strings to avoid callback hell common with chalk.

import { style } from "@tsmodule/log";

console.log(style("Hello world!", ["green", "bold"]))

Also includes log() and error() proxies for console.log and console.error, which add sensible spacing by default (can override via last paddingOptions arg) and allow for easier styling:

import { group, log } from "@tsmodule/log";

log("Styles testing! ", ["white", "bold"]);
log("Running tests...", ["bold", "underline", "grey"]);
log("✓ 10 tests passed", ["green"]);

group.start("Group 1");
log("Group 1 log 1", ["blue"]);
log("Group 1 log 2", ["blue"]);
group.end();

group.start("Group 2", ["red"]);
log("Group 2 log 1", ["italic"]);
log("Group 2 log 2", ["italic"]);
group.end();

Readme

Keywords

none

Package Sidebar

Install

npm i @tsmodule/log

Weekly Downloads

13

Version

3.0.6

License

MIT

Unpacked Size

8.62 kB

Total Files

17

Last publish

Collaborators

  • ctjlewis