JavaScript Installation

The basic JavaScript installation requires adding a single <script> tag to the top of your html page, preferrably within the <head> section.

Install ErrLog.IO with just a single small JavaScript snippet:


<script async src="https://relay.errlog.io/js/v1?apikey={your-api-key}"></script>

Example Usage

Below is a simple example of where to place the JavaScript snippet.

Manually triggering an Error

Whilst ErrLog.IO will automatically catch and log JavaScript errors once configured, you can also pass an error to it manually at any time.

ErrLog.IO will accept a standard JavaScript error object, so you can call it by using the example below.


try {
	... do something that might cause an error
}
catch(err) {
	ErrLog.logger.log(err);
}
	

 

Optional Parameters

ErrLog.IO has a number of settings available, however only one is required - the API key.

Optional Parameters

In order to configure ErrLog settings in JavaScript, initialize the `ErrLogSettings` variable before the page load event is triggered. Here's a simple example:

Logging handled errors

When your application catches an exception or hits a state you consider to be an error, you may wish to submit an error log with additional state information.

This will accessible via ErrLog, where you can access ErrLog.logging.log(...)

 

Discuss this article