explanation

0.1.2 • Public • Published

explanation

A fancy logging tool

Usage

import {info, warn, error} from 'explanation';
 
info({
  message: "Doing this",
  explain: "We want that"
});
 
warn({ // explain can be an arbitary array of messages
  message: "Something has occurred",
  explain: [ "You should have done this",
  "and you should have done this",
  "and this" ]
});
 
error({ // An instance explanation can be a 2-array
  message: "An error has occurred",
  explain: [ "You have called : ",
  data ] // Problem with this data
});
 
error({ // Explanations types can be mixed
  message: "An error has occurred",
  explain: [ ["You have called : ",
  data],
  "Dummy you!",
  ["And you have also called",
  data2],
  "That's even worse :(!" ]
});

Here is the output when the above examples were tested:

alt text

info and warn don't throw errors unless you pass an Error Type as argument. error always throws an error, either the one passed as argument or a new one generated from the message passed.

License

explanation is MIT licensed.

© 2016 Jason Lenoble

Dependents (5)

Package Sidebar

Install

npm i explanation

Weekly Downloads

3

Version

0.1.2

License

MIT

Unpacked Size

17.5 kB

Total Files

18

Last publish

Collaborators

  • jlenoble