mole-reporter [](https://travis-ci.org/molejs/mole-reporter)

September 4, 2015 ยท View on GitHub

mole-reporter is one of the three independent packages that form the whole molejs service stack. It is a reporting library, that gathers action-states on a js application and reports errors to the mole-server, including the action-states prior to the error.

It's extremely easy to implement, especially with data-workflow handlers such as redux.

All the reported logs follow the mole log specification.

Requirements

Install

npm install --save mole-reporter

Usage

The only configuration required is for setting the error-server url:

import Mole from 'mole-reporter';

Mole.config({url: 'http://errors.example.com/mole'});

To record errors, simply report them.

import Mole from 'mole-reporter';

Mole.report(error);

In order to record app action-state history, record every action and state.

import Mole from 'mole-reporter';

Mole.registerActionState(action, state);

Optional config

Extra config options are self-explanatory (values in the example are defaults).

import Mole from 'mole-reporter';

Mole.config({
    url: '',
    stacktraceLimit: 50,
    historyLimit: 10
});