Skip to content

Client Configuration Values

jmoeltjen edited this page Jul 8, 2015 · 3 revisions

Exceptionless JavaScript Client Configuration Values

Index



About

Read about Client Configuration Values on the UI Documentation Page

Usage Example

The below example demonstrates how we would turn on or off log event submissions at runtime without redeploying the app or changing server config settings.

First, we add a (completely arbitrary for this example) enableLogSubmission client configuration value key with value true in the Project's Settings in the Exceptionless dashboard.

Exceptionless Client Configuration Value

Then, we register a new client side plugin that runs each time an event is created. If our key (enableLogSubmission) is set to false and the event type is set to log, we will discard the event.

exceptionless.ExceptionlessClient.default.config.addPlugin('Conditionally cancel log submission', 100, function (context, next) {
    var enableLogSubmission = context.client.config.settings['enableLogSubmission'];
 
    // only cancel event submission if it’s a log event and
    // enableLogSubmission is set to a value and the value is not true.
    if (context.event.type === 'log' && (!!enableLogSubmission && enableLogSubmission !== 'true')) {
       context.cancelled = true;
    }
 
    next();
});

Subscribing to Setting Changes

To be notified when client configuration settings change, subscribe to them using the below code.

exceptionless.SettingsManager.onChanged(function(configuration)  {
   // configuration.settings contains the new settings
});
Clone this wiki locally