client-error-logger
v1.0.7
Published
Logging front-end errors to the server.
Downloads
10
Readme
error-logger
Logging front-end errors to the server.
Installation
$ npm install --save client-error-logger
or
$ bower install --save error-logger
The script supports amd, CommonJS, and you can just plug in a script tag on the page.
var errorLogger = require('client-error-logger');
or
require(['/bower_components/error-logger/error-logger.min'], function (errorLogger) {
errorLogger();
});
or
<script src="/js/error-logger.min.js"></script>
Usage
If logging to the server is not required, you can call errorLogger() without any parameters. If you want to write the error logs of client to server, pass as argument the address of the query processor. For example:
errorLogger('http://my-best-site.com/logger.php');
Will be sent POST request with three parameters:
- message - error message
- file - in what file an error occurred,
- line - on what line of code error occurred.