@eonx/reporter
v1.2.0
Published
## Getting started
Downloads
12
Readme
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: '[email protected]',
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;
};
}