DOCUMENTATION

Node.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 Node.js application so that it reports unhandled exceptions to the Logify Alert service.

Add the Logify Alert Client to Your Project

Open the Command Prompt from your project's root directory and run the following command.

npm install logify-alert --save

All required Logify Alert files will automatically be copied to the node_modules folder.

Enable Automatic Reporting

To automatically intercept all unhandled exceptions and send corresponding crash reports to Logify Alert, add the following code anywhere within the JavaScript file.

const logifyAlert = require('logify-alert'); let client = new logifyAlert("SPECIFY_YOUR_API_KEY_HERE"); client.startHandling();

Manual Reporting

Use the following code to catch exceptions and send reports manually.

// Sends exception var logifyAlert = require('logify-alert'); process.on('uncaughtException', (error) => {   var client = new logifyAlert('SPECIFY_YOUR_API_KEY_HERE');   client.sendException(error); }); // Sends rejection process.on('unhandledRejection', (reason, promise) => {   var client = new logifyAlert('SPECIFY_YOUR_API_KEY_HERE');   client.sendRejection(reason); });

Rebuild and Redeploy Your Application

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

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