DOCUMENTATION

Node.js Client

To add the Logify Alert client to the application's code, execute the following command. npm install logify-alert --save

The client is represented by the logifyAlert class that consists of the following constructors, properties, methods and callbacks.

Constructors

logifyAlert(apiKey)

Initializes a new instance of the logifyAlert class.

The apiKey parameter specifies an API Key used to initialize your application within the Logify Alert service.

let client = new logifyAlert('SPECIFY_YOUR_API_KEY_HERE')

Properties

applicationName

Type: String
Default value: null

Specifies an application name.

client.applicationName = 'My Application';

applicationVersion

Type: String
Default value: null

Specifies an application version.

client.applicationVersion = '1.0.1';

customData

Type: Object

Gets the collection of custom data sent with generated reports.

Use the CustomData property to attach additional information to the generated report. For instance, you can use this property to track additional metrics that are important in terms of your application. The first key can only consists of a-z, A-Z, 0-9, and _ characters.

client.customData = {FIRST_KEY: "FIRST DATA", SECOND_KEY: "SECOND DATA"};

tags

Type: Object

Gets the collection of tags specifying additional report fields, which will be used in auto ignoring, filtering or detecting duplicates.

A key is a tag name (a string that consists of a-z, A-Z, 0-9, and _ characters), and a value is a tag value that is saved to a report. A new tag is added with Allow search enabled.

client.tags["tag_name"] = "tag_value";

userId

Type: String
Default value: null

Specifies a unique user identifier that corresponds to a sent report.

client.userId = 'A unique user identifier';

Methods

sendException(error)

Generates a crash report based on the caught exception and sends this report to the Logify Alert service.

client.sendException(error);

sendRejection(reason)

Generates a crash report based on the caught rejection and sends this report to the Logify Alert service.

client.sendRejection(reason);

startHandling

Commands Logify Alert to start listening to uncaught exceptions and rejections, and send reports for all processed entries.

client.startHandling();

stopHandling

Commands Logify Alert to stop listening to uncaught exceptions and rejections.

client.stopHandling();

Callbacks

afterReportException(error)

Specifies a delegate to be called after sending exceptions and rejections to the Logify Alert server.

The error parameter holds an error text that indicates the report sending result. The undefined value specifies that the crash report has been successfully sent. The "The report was not sent" value specifies that the crash report has not been sent.

client.afterReportException = function (error) {
        if (error == undefined) {
            // The report has been successfully sent
        }
        
        if (error == "The report was not sent") {
            // The report has not been sent
        }
}

beforeReportException(customData)

Specifies a delegate to be called before sending exceptions and rejections to the Logify Alert server.

The customData parameter holds custom data sent along with an exception or a rejection. The default value is undefined. If you change a parameter value within a callback, a new value will be stored and passed to a callback the next time you call it in your application.

client.beforeReportException = function (customData) {
    if (customData == undefined) {
        customData = {};
    }
    customData["test key"] = "test value";
    return customData;
}

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