Skip to content

Repository files navigation

solace NPM versionBuild StatusDependency StatusCoverage percentage

Alternative to the console log which automatically beautifies the output

Solace is particularly useful if you intend:

  • to debug some data.
  • to display some data for a CLI.

Solace has a specific support for string, boolean, number, date, regex, null, void, error, NaN, object, array and will deal with these types in a pleasant way.

By default, the output is expected to be stdout/stderr, but you can override this to implement more advanced logging.

The theme (machine, beautiful, outline) can be changed at runtime, which can be a handy option for the user of a CLI.

Installation

$ npm install --save solace

Usage

importsolaceCreatorfrom'solace';constsolace=solaceCreator({//standardOut: process.stdout,//standardErr: process.stderr,//defaultTheme: 'beautiful'});constvalue={a: 12b: ['jan','feb','mar'],c: true,d: newDate()};solace.log('Some data nicely arranged:');solace.log(value,{title: 'title',theme: 'outline'});

Themes

  • machine: Format the output in a compact manner easily readable by a machine.
  • beautiful: Format the output in a beautiful manner.
  • outline: Format the output with the main outlines. If the data is an array of objects, it may be displayed as a table.

Example of beautiful output:

Beautiful theme

Example of outline output:

Outline theme

License

MIT © flarebyte

About

Alternative to console log which automatically beautifies the output

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages