DOCUMENTATION

JavaScript (JS)

See the basic setup steps below to get started with the Logify Alert service:


Generate an API Key

The Logify Alert service uses unique identifiers – API keys – to register and monitor individual applications. You will use this key later when creating an instance of Logify Alert client in code.

  1. Log in to the Logify Alert website: logify.devexpress.com.

  2. Switch to the Applications tab and click Create New Application.

  3. Specify the application name and description, then click Create.

  4. The Applications tab will now display a new entry with an auto-generated API key.

Send Reports to Logify Alert

This section explains how to modify your JavaScript application so that it reports unhandled exceptions to the Logify Alert service.

Add the Logify Alert Client to Your Project

In the application's source code, add the following script to link Logify Alert client.

<script type="text/javascript" src="https://logifyjs.devexpress.com/logifyAlert.min.js"></script>

<script type="text/javascript" src="https://logifyjs.devexpress.com/logifyAlert.js"></script>

<script type="text/javascript" src="https://logifyjs.devexpress.com/0.0.5/logifyAlert.min.js"></script>

Enable Automatic Reporting

Logify Alert provides you with two main approaches used to send reports: automatic reporting and manual reporting.

Use the following code to automatically intercept all unhandled exceptions and send corresponding crash reports to Logify Alert:

<script type="text/javascript"> var logify = new logifyAlert("SPECIFY_YOUR_API_KEY_HERE"); logify.applicationName = "Test application"; logify.startHandling(); </script>

Manual Reporting

Use the following code to automatically intercept all unhandled exceptions and send corresponding crash reports to Logify Alert:

<script type="text/javascript" src="https://logifyjs.devexpress.com/logifyAlert.min.js"></script> <script type="text/javascript"> // Sends exception window.onerror = function myErrorHandler(errorMsg, url, lineNumber, column, errorObj) {   LogifyAlert client = new LogifyAlert("SPECIFY_YOUR_API_KEY_HERE");   client.sendException(errorMsg, url, lineNumber, column, errorObj);   return true; } // Sends rejection window.addEventListener('unhandledrejection', event => {   LogifyAlert client = new logifyAlert("SPECIFY_YOUR_API_KEY_HERE");   client.sendRejection(event.reason, event.promise); }); </script>

Redeploy the Application

Once your updated application has been redeployed, log in to logify.devexpress.com to review and process incoming reports.

Terms of use Copyright © 2016-2023 Developer Express Inc.