DOCUMENTATION

JavaScript (JS) Client

To add the Logify Alert client to the application's code, add the following code to your application's code <script type="text/javascript" src="https://logifyjs.devexpress.com/logifyAlert.min.js"></script>

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.

var 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';

collectBreadcrumbs

Type: Boolean
Default value: false

Specifies whether automatic breadcrumbs collecting is enabled.

The total breadcrumbs size is limited by 1000 instances (or 3 Mb) per one crash report by default. To change the maximum allowed size of attached breadcrumbs, use the breadcrumbsMaxCount property.

var logify = new logifyAlert("YOUR_API_KEY_HERE"); logify.collectBreadcrumbs = true; logify.startHandling();

collectCookies

Type: Boolean
Default value: false

Specifies whether Logify Alert collects cookies and sends them with the generated reports.

client.collectCookies = true;

collectInputs

Type: Boolean
Default value: false

Specifies whether Logify Alert collects all inputs passed to a web page (except for passwords). The collected information stores an input's type, identifier, tag name and value.

client.collectInputs = true;

collectLocalStorage

Type: Boolean
Default value: false

Specifies whether Logify Alert collects the information on a local storage and sends this information with the generated reports.

client.collectLocalStorage = true;

collectSessionStorage

Type: Boolean
Default value: false

Specifies whether Logify Alert collects the information on a session storage and sends this information with the generated reports.

client.collectSessionStorage = true;

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"};

sensitiveDataFilters

Type: Array

An array of keys specifying fields whose values should be excluded from crash reports sent to Logify Alert. These keys are applied to breadcrumbs, inputs passed to a web page, local and session storage data.

Pass strings (case-insensitive) or RegEx objects as keys to the array.

client.sensitiveDataFilters = ["password", /credit.*/];

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

addBreadcrumbs(breadcrumb)

Adds a new instance to a collection of manual breadcrumbs attached to a report. The total breadcrumbs size is limited by 100 instances (or 3 Mb) per one crash report by default. To change the maximum allowed size of attached breadcrumbs, use the breadcrumbsMaxCount property.

client.addBreadcrumbs({ "dateTime": new Date().toUTCString(), "event": "manual", "message": "A manually added breadcrumb" });

sendException(errorMsg, url, lineNumber, column, errorObj)

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

client.sendException(errorMsg, url, lineNumber, column, errorObj);

sendRejection(reason, promise)

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

client.sendRejection(reason, promise);

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.