API that provides formatting and highlight options for errors and their stack trace
Want to see pretty graphs? Log in now!
npm install formaterrors
|25||downloads in the last day|
|113||downloads in the last week|
|598||downloads in the last month|
|Last Published By|
|Version||0.1.2 last updated 2 years ago|
|Keywords||errors, logging, testing, test, log|
An API that provides various options for formatting and highlighting Errors. May be useful for logging and test frameworks for example.
Stack lines can be filtered in and out based on patterns and limited by range (e.g. lines 2 through 10). Stack lines and error message can have highlights applied based on patterns. Finally stack lines can be formatted to include or exclude available fields.
The API is quite flexible with a range of methods varying in level with means to specify custom highlights and formats.
$ npm install formaterrors
Or include as a dependency within packakage.json and use: npm link.
var formatErrors = require("formaterrors");
Then invoke the provided APIs on instances of Error or Error.stack as required.
Some examples are available within the examples folder. They can be executed as follows:
Here is the HTML source of the API docs. These docs needs to be downloaded and opened in a browser.
First install the dependencies:
$ npm link
Then to run the tests:
$ npm test
- Changing the stack line prefix and subsequently applying stack highlights or theme is not likely to produce the desired result because the stack prefix is key to differentiating between the message and the stack lines parts of the error stack.