UNPKG

@newrelic/newrelic-capacitor-plugin

Version:
176 lines 5.93 kB
import { WebPlugin } from '@capacitor/core'; import { NREnums } from './definitions'; export class NewRelicCapacitorPluginWeb extends WebPlugin { start(_options) { // throw new Error('Method not implemented.'); } setUserId(_options) { //throw new Error('Method not implemented.'); } setAttribute(_options) { //throw new Error('Method not implemented.'); } removeAttribute(_options) { //throw new Error('Method not implemented.'); } recordBreadcrumb(_options) { // throw new Error('Method not implemented.'); } recordCustomEvent(_options) { // throw new Error('Method not implemented.'); } startInteraction(_options) { return new Promise((resolve) => { resolve({ value: '' }); }); } endInteraction(_options) { // throw new Error('Method not implemented.'); } crashNow(_options) { //throw new Error('Method not implemented.'); } currentSessionId(_options) { //throw new Error('Method not implemented.'); return new Promise((resolve) => { resolve({ sessionId: '' }); }); } incrementAttribute(_options) { // throw new Error('Method not implemented.'); } noticeNetworkFailure(_options) { // throw new Error('Method not implemented.'); } noticeHttpTransaction(_options) { // throw new Error('Method not implemented.'); } recordMetric(_options) { // throw new Error('Method not implemented.'); } removeAllAttributes(_options) { // throw new Error('Method not implemented.'); } setMaxEventBufferTime(_options) { // throw new Error('Method not implemented.'); } setMaxEventPoolSize(_options) { // throw new Error('Method not implemented.'); } setMaxOfflineStorageSize(_options) { // throw new Error('Method not implemented.'); } recordError(_options) { // throw new Error('Method not implemented.'); } analyticsEventEnabled(_options) { // throw new Error('Method not implemented.'); } networkRequestEnabled(_options) { // throw new Error('Method not implemented.'); } networkErrorRequestEnabled(_options) { // throw new Error('Method not implemented.'); } httpResponseBodyCaptureEnabled(_options) { // throw new Error('Method not implemented.'); } getAgentConfiguration(_options) { let a = { analyticsEventEnabled: true, crashReportingEnabled: true, interactionTracingEnabled: true, networkRequestEnabled: true, networkErrorRequestEnabled: true, httpResponseBodyCaptureEnabled: true, webViewInstrumentation: true, loggingEnabled: true, logLevel: '', collectorAddress: '', crashCollectorAddress: '', sendConsoleEvents: true, fedRampEnabled: false, offlineStorageEnabled: true, distributedTracingEnabled: false, }; return new Promise((resolve) => { resolve(a); }); } shutdown(_options) { // throw new Error('Method not implemented.'); } generateDistributedTracingHeaders(_options) { let dtHeaders = { newrelic: "1", traceparent: "1", tracestate: "1", traceid: "1", guid: "1", id: "1" }; return new Promise((resolve) => { resolve(dtHeaders); }); // throw new Error('Method not implemented.'); } addHTTPHeadersTrackingFor(_options) { // throw new Error('Method not implemented.'); } log(_options) { if (_options.message === undefined || _options.message.length === 0) { // If the message is empty, log an error message and return console.error("Log message is empty."); return; } // Create a new Map to store attributes let attributes = new Map(); // Set the message and log level as attributes attributes.set("message", _options.message); attributes.set("level", _options.level); // Log the attributes this.logAttributes({ attributes: attributes }); } logError(_options) { this.log({ level: NREnums.LogLevel.ERROR, message: _options.message }); } logWarning(_options) { this.log({ level: NREnums.LogLevel.WARNING, message: _options.message }); } logAll(_options) { let allAttributes = new Map(); // Set the error message as an attribute allAttributes.set("message", _options.error); // Iterate over the attributes Map and add each attribute to allAttributes for (let [key, value] of Object.entries(_options.attributes)) { allAttributes.set(key, value); } // Log all attributes this.logAttributes({ attributes: allAttributes }); } logInfo(_options) { this.log({ level: NREnums.LogLevel.INFO, message: _options.message }); } logVerbose(_options) { this.log({ level: NREnums.LogLevel.VERBOSE, message: _options.message }); } logDebug(_options) { this.log({ level: NREnums.LogLevel.AUDIT, message: _options.message }); } logAttributes(_options) { if (_options.attributes === undefined || _options.attributes.size === 0) { // If the attributes are empty, log an error message and return console.error("Attributes are empty."); return; } } getHTTPHeadersTrackingFor() { let httpHeadersTracking = { headersList: "[]" }; return new Promise((resolve) => { resolve(httpHeadersTracking); }); } } //# sourceMappingURL=web.js.map