@coralogix/browser
TypeScript icon, indicating that this package has built-in type declarations

1.0.48 • Public • Published

Official Coralogix SDK for Browsers

npm version

Links

Usage

To use Coralogix SDK for Browsers, call CoralogixRum.init(options) at the soonest available moment after the page load. This will initialize the SDK based on the options you provided.

import { CoralogixRum } from '@coralogix/browser';

CoralogixRum.init({
  application: 'app-name',
  environment: 'production',
  public_key: 'abc-123-456',
  coralogixDomain: 'EU2',
  version: 'v1.0.3',
  labels: {
    payment: 'visa',
  },
  ignoreErrors: ['some error message to ignore'],
});

More properties: instrumentations, traceParentInHeader, ignoreUrls, debug

To provide contextual information or transmit manual logs, utilize the exported functions of CoralogixRum. Keep in mind that these functions will remain inactive until you've invoked CoralogixRum.init().

import { CoralogixRum } from '@coralogix/browser';

// Update user context dynamically
CoralogixRum.setUserContext({
  user_id: '123',
  user_name: 'name',
  user_email: 'user@email.com',
  user_metadata: {
    role: 'admin',
    // ...
  }
})

// Update custom labels dynamically
CoralogixRum.setLabels({
   paymentMethod: 'visa',
   userTheme: 'black'
  // ...
})

// Update application context dynamically
CoralogixRum.setApplicationContext({
  application: 'app-name',
  version: '1.0.0'
})

CoralogixRum.log(CoralogixLogSeverity.Error, 'this is a log', { key: 'value' })
CoralogixRum.error('this is a log with error severity', { key: 'value' })

Readme

Keywords

none

Package Sidebar

Install

npm i @coralogix/browser

Weekly Downloads

641

Version

1.0.48

License

MIT

Unpacked Size

153 kB

Total Files

77

Last publish

Collaborators

  • coralogixnpm