@eonx/reporter
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Reporter

Getting started

# Install reporter library
yarn add @eonx/reporter

# Install required engines
yarn add @eonx/reporter-bugsnag-vue

Usage

import { reporter } from '@eonx/reporter';

reporter.configure({
  /*
   * You can define a custom URL to receive remote configuration.
   * If not, default URL will be used.
   */
  remoteConfigUrl: 'https://mock.dev/reporter/config',
  releaseStage: 'development',
  appVersion: '0.0.4',
  engines: {
    bugsnag: () => import('@eonx/reporter-bugsnag-vue'),
  },
  user: {
    id: 'guest',
  },
});

reporter.initWithKey('api_key').then(() => {
  // reporter initalized

  /*
   * Later in application you can define a user.
   */
  reporter.configure({
    user: {
      id: '007',
      email: 'send@me.com',
      name: 'John Smith',
    },
  });
});

If installed engine should be injected into the application, you can access to the plugin via getAppPlugin method.

import { createApp } from 'vue';
import { reporter } from '@eonx/reporter';

const app = createApp(App);
const reporterAppPlugin = reporter.getAppPlugin();

if (reporterAppPlugin) {
  app.use(reporterAppPlugin);
}

app.mount('#app');

Reporter remote configuration API

type ReporterType = 'bugsnag' | string;

interface RemoteConfig {
  reporter: ReporterType;
  filters: string[];
  isEnabled: boolean;
  configuration: {
    apiKey: string;
  };
}

Reporter Engines

Readme

Keywords

Package Sidebar

Install

npm i @eonx/reporter

Weekly Downloads

0

Version

1.2.0

License

MIT

Unpacked Size

8.61 kB

Total Files

18

Last publish

Collaborators

  • ryan.goce.eonx
  • natepage