npm.io
3.5.2 • Published 2 years ago

@jsenv/log

Licence
MIT
Version
3.5.2
Deps
5
Size
15 kB
Vulns
0
Weekly
0
Stars
36

Log npm package

This packages is used by jsenv to create beautiful logs in the console. It is available as a standalone package to be used in other contexts.

This package helps to:

  • add symbols via unicode
  • make dynamic logs
  • add color to logs

Task log example

(Click image to play the gif)

img

Code used to produce these logs:

import { createTaskLog } from "@jsenv/log";

const task = createTaskLog("Doing something");
setTimeout(() => {
  task.done();
}, 1_000);

Unicode example

img

Code used to produce these logs:

import { UNICODE } from "@jsenv/log";

console.log(`${UNICODE.COMMAND} cd dir/`);
console.log(`${UNICODE.DEBUG} debug`);
console.log(`${UNICODE.INFO} info`);
console.log(`${UNICODE.WARNING} warning`);
console.log(`${UNICODE.FAILURE} failure`);
console.log(`${UNICODE.OK} ok`);

Installation

npm install @jsenv/log